History log of /u-boot/common/usb_storage.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>

# a79fc7a7 27-Apr-2024 Tom Rini <trini@konsulko.com>

common: Remove <common.h> and add needed includes

Remove <common.h> from all "commmon/" files and when needed add
missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 75aabe59 29-Oct-2023 Hector Martin <marcan@marcan.st>

usb: storage: Use the correct CBW lengths

USB UFI uses fixed 12-byte commands (as does RBC, which is not
supported), but SCSI does not have this limitation. Use the correct
command block lengths depending on the subclass.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7020b2ec 26-Sep-2023 Bin Meng <bmeng@tinylab.org>

blk: Use a macro for the typical block size

Avoid using the magic number 512 directly.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d7d78576 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Rename bootdev_setup_sibling_blk()

This name is a little confusing since it suggests that it sets up the
sibling block device. In fact it sets up a bootdev for it. Rename the
function to make this clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 04448899 04-Nov-2022 Janne Grunau <j@jannau.net>

usb: storage: continue probe on "Invalid device"

Fixes a crash during probing of sd card readers without medium present.
Seen with the device below but reported for many other devices.

idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x0326 Card reader
bcdDevice 11.24
iManufacturer 1 Realtek
iProduct 2 USB3.0 Card Reader
iSerial 3 201404081410

Link: https://github.com/AsahiLinux/linux/issues/44
Link: https://lists.denx.de/pipermail/u-boot/2022-July/489717.html

Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 8149b150 17-Sep-2022 Simon Glass <sjg@chromium.org>

blk: Rename if_type to uclass_id

Use the word 'uclass' instead of 'if_type' to complete the conversion.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ccb0ac5 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: usb: Add a bootdev driver

Add a bootdev driver for USB host. It can use the distro boot mechanism to
locate a file, or any other available bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8c9812a5 08-Mar-2022 AKASHI Takahiro <akashi.tkhro@gmail.com>

usb: storage: call device_probe() after scanning

Every time a usb bus/port is scanned and a new device is detected,
we want to call device_probe() as it will give us a chance to run
additional post-processings for some purposes.

In particular, support for creating partitions on a device will be added.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0cf207ec 27-Sep-2021 Wolfgang Denk <wd@denx.de>

WS cleanup: remove SPACE(s) followed by TAB

Signed-off-by: Wolfgang Denk <wd@denx.de>

# bc0b99bd 06-Jan-2021 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2021.04

arm64:
- DT updates

microblaze:
- Add support for NOR device support

spi:
- Fix unaligned data write issue

nand:
- Minor code change

xilinx:
- Fru fix in limit calculation
- Fill git repo link for all Xilinx boards

video:
- Add support for seps525 spi display

tools:
- Minor Vitis file support

cmd/common
- Minor code indentation fixes

serial:
- Uartlite debug uart initialization fix


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@amd.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31232de0 06-Apr-2020 Marek Vasut <marex@denx.de>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]

# da3d1c49 05-Oct-2019 Marek Vasut <marex@denx.de>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 7d6fd7f0 15-Sep-2019 Marek Vasut <marex@denx.de>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# d0851c89 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dee37fc9 06-Aug-2018 Masahiro Yamada <masahiroy@kernel.org>

Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

typedef unsigned int u32;
typedef unsigned long uintptr_t;
typedef unsigned long long u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly. You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 72ac8f3f 27-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# ea7fad91 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled

When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 6158d0b4 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Refactor to use max_xfer_blk from struct us_data

This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# b9560ad6 14-Jun-2017 Simon Glass <sjg@chromium.org>

dm: scsi: Drop the ccb typedef

We should not be using typedefs in U-Boot and 'ccb' is a pretty short
name. It is also used with variables. Drop the typedef and use 'struct'
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8850c5d5 12-May-2017 Tom Rini <trini@konsulko.com>

Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1e5eca7d 10-Apr-2017 Troy Kisky <troy.kisky@boundarydevices.com>

usb: return 0 from usb_stor_get_info even if removable media

This fixes a regression caused by

commit 07b2b78ce4bc8ae25e066c65245eaf58c0d9a67c
dm: usb: Convert USB storage to use driver-model for block devs

which caused part_init to be called when it was not previously.
Without this patch, the following happens when a USB sd card reader is used.

=> usb start
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1 for devices... 3 USB Device(s) found
scanning usb for storage devices... Device NOT ready
Request Sense returned 02 3A 00
### ERROR ### Please RESET the board ###

This happens because dev_desc->blksz is 0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

# b984700c 21-Dec-2016 Michal Simek <michal.simek@amd.com>

usb: storage: Show number of storage devices detected for DM_USB

By enabling DM_USB information about number of storage devices
was lost.
Get this information back simply by printing number of devices detected
via BLK uclass.

For example:
scanning bus 0 for devices... 7 USB Device(s) found
scanning usb for storage devices... 3 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 8319aeb1 06-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9107c973 01-May-2016 Simon Glass <sjg@chromium.org>

dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 57ebf67b 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0543bf6 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b94fc851 16-Mar-2016 Simon Glass <sjg@chromium.org>

usb: Correct return value in usb_stor_info()

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# a6f70a3d 15-Mar-2016 Vagrant Cascadian <vagrant@debian.org>

Fix spelling of "transferred".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 07b2b78c 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Convert USB storage to use driver-model for block devs

Update this code to support CONFIG_BLK. Each USB storage device can have
one or more block devices as children, each one representing a LUN
(logical unit) of the USB device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 9807c3b7 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Tidy up storage code ready for driver model conversion

Adjust a few things so that the addition of driver-models support involved
adding code rather than also changing it. This makes the patches easier to
review.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c89e79d4 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Avoid exceeding available array size for storage devices

The limit on storage devices is USB_MAX_STOR_DEV but we use one extra
element while probing to see if a device is a storage device. Avoid this,
since it causes memory corruption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# bcce53d0 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 3e8bd469 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: part: Rename some partition functions

Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4101f687 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: Drop the block_dev_desc_t typedef

Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4ef79099 07-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7c4213f6 07-Dec-2015 Stephen Warren <swarren@nvidia.com>

block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 70caa971 03-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Allow up to 7 storage devices

The current limit of 5 is not enough for the driver model USB tests. Really
we should not have a limit but the driver model code still uses the
usb_dev_desc[] array, which has a limit.

Increasing the limit by 2 should not bother anyone. Adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f5fb78a2 11-Oct-2015 Tom Rini <trini@konsulko.com>

common/usb_storage.c: Clean up usb_storage_probe()

We have the protocol and subclass variables which are used only in
disabled debug code. This code dates back to the initial git import and
seemingly dead code so remove it.

This was detected by Coverity (CID 131117)

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcbe3d15 28-Sep-2015 Simon Glass <sjg@chromium.org>

dm: Rename dev_get_parentdata() to dev_get_parent_priv()

The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

# cf92e05c 02-Sep-2015 Simon Glass <sjg@chromium.org>

Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header

Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# abb59cff 06-Jul-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust the USB_DEVICE() macro naming

In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
We should follow the same convention in U-Boot. Rename the existing
USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
macro from Linux for use in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>

# acf277af 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Convert usb_storage to driver model

Add support for scanning USB storage devices with driver model. This mostly
involves adding a USB device ID for storage devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 91557579 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move storage device scanning into its own function

The usb_stor_scan() function is quite long, so split out the code that scans
each device into its own function. Also, rather than setting up the block
device list once at the start, set it up as each device is scanned. This
makes it possible to use this code from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7fc2c1ea 16-Apr-2015 Simon Glass <sjg@chromium.org>

Revert "usb_storage : scan all interfaces to find a storage device"

This reverts commit cd749658d5994978579628a6333e5c2a6c8ec632.

The conflicts with this commit are hard for me to figure out. I will re-apply
it later.

# 05108132 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust usb_storage to work with sandbox

With a few tweaks we can compile this code with sandbox and enable testing
of the USB storage layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 84073b6f 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Simply device finding code in usb_storage

The for() loop is not needed since the value is immediately accessible.
Use this instead to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1d5827a1 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2e17c87e 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move USB storage definitions to usb_defs.h

These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f6570871 01-Apr-2015 Sergey Temerkhanov <s.temerkhanov@gmail.com>

usb_storage:Fix USB storage capacity detection on 64 bit architectures

This patch fixes USB storage capacity detection breakage on 64-bit systems
which arises due to 'unsigned long' length difference. Old code assumes that
to be 32 bit and breaks because of inappropriate response buffer layout.
Also this fixes a number of build warnings and changes big-endian values
treatment style to be architecture-independent

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>

# cd749658 04-Mar-2015 Franck Jullien <franck.jullien@gmail.com>

usb_storage : scan all interfaces to find a storage device

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>

# 6a559bbe 07-Nov-2014 Soeren Moch <smoch@web.de>

usb_storage: blacklist Enclosure Service Devices

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>

# 4fd074de 15-Oct-2014 Simon Glass <sjg@chromium.org>

usb: Use correct printf() format string for uintptr_t

Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ff8fef56 14-Jun-2013 Sascha Silbe <t-uboot@infra-silbe.de>

Fix block device accesses beyond 2TiB

With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>

# 605bd75a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

USB: Some cleanup prior to USB 3.0 interface addition

Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# ceb4972a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

usb: common: Weed out USB_**_PRINTFs from usb framework

USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# 0472fbfd 09-Apr-2013 Egbert Eich <eich@suse.com>

part/dev_desc: Add log2 of blocksize to block_dev_desc data struct

log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>

# 8b57e2f0 12-Dec-2012 Vincent Palatin <vpalatin@chromium.org>

usb: properly detect empty mass storage media reader

When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 199adb60 29-Oct-2012 Kim Phillips <kim.phillips@freescale.com>

common/misc: sparse fixes

command.c:44:38: error: bad constant expression
dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
hush.c:2175:20: warning: Using plain integer as NULL pointer
hush.c:2175:34: warning: Using plain integer as NULL pointer
hush.c:2210:41: warning: Using plain integer as NULL pointer
hush.c:2216:45: warning: Using plain integer as NULL pointer
hush.c:2249:25: warning: Using plain integer as NULL pointer
hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
hush.c:3295:34: warning: Using plain integer as NULL pointer
hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
image.c:1282:29: warning: Using plain integer as NULL pointer
image.c:1315:41: warning: Using plain integer as NULL pointer
image.c:1330:25: warning: Using plain integer as NULL pointer
image.c:1706:25: warning: Using plain integer as NULL pointer
main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
usb_storage.c:440:48: warning: Using plain integer as NULL pointer
usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
usb_storage.c:629:55: warning: Using plain integer as NULL pointer
usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
usb_storage.c:675:43: warning: Using plain integer as NULL pointer
usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

note: hush.c's nesting_level deleted because not used.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# e81e79ed 12-Oct-2012 Gabe Black <gabeblack@chromium.org>

usb: Support the CONFIG_SYS_64BIT_LBA option

usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 93c2582f 25-Sep-2012 Lucas Stach <dev@lynxeye.de>

usb: add support for multiple usb controllers

Allows to initialize more than one USB controller at once.

v2: print message when controller stop fails

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>

# b7006958 30-Jul-2012 Jim Shimer <jamesshimer@motorola.com>

usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

# 3e8581bb 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
- Rebase against the latest u-boot-usb master.
- Replace typedef with #define.
- Use the existing flags struct field instead of adding a new field.
- Remove the setter function.
- Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>

# 4bee5c83 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# cffcc503 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# 1b4bd0e6 09-Jul-2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

usb_storage: fix ehci driver max transfer size

The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage:
Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in
usb_storage as it wrongly assumes that every transfer can use
4096 bytes per qt_buffer. This is wrong if the start address of
the data is not page aligned to 4096 bytes and leads to 'EHCI
timed out on TD' messages because of 'out of buffer pointers'
in ehci_td_buffer function.

The bug appears during load of a fragmented file and
read from or write to an unaligned memory address.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# f5766139 03-Apr-2012 Puneet Saxena <puneets@nvidia.com>

USB: Align buffers at cacheline

This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>

# 5b84dd67 05-Mar-2012 Mike Frysinger <vapier@gentoo.org>

usb: replace wait_ms() with mdelay()

Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>

# 5dd95cf9 21-Dec-2011 Kyle Moffett <Kyle.D.Moffett@boeing.com>

usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

# 4b210e8b 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash subsequent warnings in usb_storage.c

usb_storage.c: In function ‘us_one_transfer’:
usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_reset’:
usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_comdat’:
usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_transport’:
usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_transport’:
usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Remy Bohmer <linux@bohmer.net>

# 86bd3ff8 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash warning in usb_storage.c

usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>

# f092f15d 04-Oct-2011 Wolfgang Denk <wd@denx.de>

Revert "GCC4.6: Convert various empty macros to inline functions"

This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac.

The commit causes build breakage for a number of boards. This results
from the fact that now the arguments of debug() actually get
referenced (even if there is hope that the compiler will optimize
away the debug() call). The obvious fix to that probem (change the
code to always declare the referenced variables and data structures)
increases the code size, and was this rejected. So it was decided to
revert this commit until a better solution is found.

# 60ce53cf 26-Sep-2011 Marek Vasut <marex@denx.de>

GCC4.6: Convert various empty macros to inline functions

Fix the following gcc4.6 problems:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]
asix.c: In function ‘asix_init’:
asix.c:317:6: warning: variable ‘rx_ctl’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_parse_config’:
usb.c:331:17: warning: variable ‘ch’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_port_connect_change’:
usb.c:1123:29: warning: variable ‘portchange’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_configure’:
usb.c:1183:25: warning: variable ‘hubsts’ set but not used
[-Wunused-but-set-variable]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>

# df3fc526 23-May-2011 Matthew McClintock <msm@freescale.com>

disk/part.c: Make features optional

If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>

# 6052cbab 03-Feb-2011 Loïc Minier <loic.minier@linaro.org>

Fix misc spelling errors found by lintian

Signed-off-by: Lo�c Minier <loic.minier@linaro.org>

# 56887e27 24-Mar-2011 Erik Hansen <erik@makarta.com>

Remove unnecessary reset in usb_stor_get_info

The reset request in usb_stor_get_info is causing issues with some usb
sticks. Some of these sticks vendor_id/product_id have been hardcoded to
not reset but better is to remove the reset altogether. It is not needed.

Signed-off-by: Erik Hansen <erik@makarta.com>

# 2ff12285 20-Oct-2010 Mike Frysinger <vapier@gentoo.org>

usb_storage: constify us_direction lookup table

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 99e9ed1f 05-Oct-2010 Ludovic Courtès <ludo@gnu.org>

usb: Add support for multiple-LUN mass storage devices

This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device. It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>

# 226fa9bb 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: change progress output in debug() message

The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
. <<==== here
29 file.001
29 file.002
29 file.003
29 file.004
29 file.005
29 file.006
29 file.007
29 file.008
29 file.009
29 file.010
29 file.011
29 file.012
29 file.013
29 file.014
29 file.015
29 file.016
. <<==== here
29 file.017
29 file.018
29 file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# a17c548b 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: initialize device type

The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

=> usb part
print_part of 0

Partition Map for USB device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 0 2031616 f8

print_part of 1
## Unknown partition table

print_part of 2
## Unknown partition table

print_part of 3
## Unknown partition table

print_part of 4
## Unknown partition table
=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# fac71cc4 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage probe

While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# aaad108b 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage count

Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# 127e1084 02-Nov-2009 Mahavir Jain <mjain@marvell.com>

usb: write command for RAW partition.

This patch implements write support to usb device with raw partition.
It will be useful for filesystem write support to usb device from
u-boot in future.

Tested with writing kernel image to raw usb disk & booting with usb
read command into ram.

[Note: run usb part to get info about start sector & number of
sectors on a partition for usb write operation.]

Signed-off-by: Mahavir Jain <mjain@marvell.com>

# 8f8bd565 30-Oct-2009 Tom Rix <Tom.Rix@windriver.com>

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

unsigned char bRefresh
unsigned char bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h. The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>

# 792a09eb 13-May-2009 Detlev Zundel <dzu@denx.de>

Fix e-mail address of Gary Jennejohn.

Signed-off-by: Detlev Zundel <dzu@denx.de>

# 9704f9ca 28-Oct-2008 Abraham, Thomas <t-abraham@ti.com>

USB: Remove LUN number from CDB

The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB.

Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# c7d703f3 01-Jan-2009 Mike Frysinger <vapier@gentoo.org>

usb.h: use standard __LITTLE_ENDIAN from Linux headers

Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# 14e4111c 01-Jan-2009 Bryan Wu <Bryan.Wu@analog.com>

usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb drive

The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4
does not like to be reset, so check for it.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# a0cb3fc3 10-Dec-2008 Michael Trimarchi <trimarchi@gandalf.sssup.it>

USB storage cleanup patch

Cleanup usb storage

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# d6e9ee92 12-Aug-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

common: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# d0ff51ba 14-Jul-2008 Wolfgang Denk <wd@denx.de>

Code cleanup: fix old style assignment ambiguities like "=-" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c918261c 21-May-2008 Christian Eggers <ceggers@gmx.de>

USB: replace old swap_ with proper endianess conversion macros

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 1aeed8d7 13-Apr-2008 Wolfgang Denk <wd@denx.de>

Coding Style cleanup; update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b9e749e9 26-Mar-2008 Markus Klotzbuecher <mk@denx.de>

USB, Storage: fix a bug introduced in commit
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info
to only print only information on one storage device, but not for
multiple.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# f6b44e0e 24-Mar-2008 Aras Vaichas <arasv@magtech.com.au>

USB Storage, add meaningful return value

This patch changes the "usb storage" command to return success if it
finds a USB storage device, otherwise it returns error.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 409ecdc0 18-Nov-2007 Wolfgang Denk <wd@denx.de>

Fix compiler warnings for PPC systems. Update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 90253178 10-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/: Remove lingering references to CFG_CMD_* symbols.

Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# c3517f91 08-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDS

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# b453960d 11-Jun-2007 Jon Loeliger <jdl@jdl.com>

common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).

This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# eb867a76 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers

Block device read/write is anonymous data; there is no need to use a
typed pointer. void * is fine. Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 735dd97b 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 1_4] Merge common get_dev() routines for block devices

Each of the filesystem drivers duplicate the get_dev routine. This change
merges them into a single function in part.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 73652699 19-Oct-2006 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# ddde6b7c 22-Aug-2006 Bartlomiej Sieka <tur@semihalf.com>

Add a fix for a buggy USB device on the FO300 board.

# f88a0ae6 13-Jul-2006 Bartlomiej Sieka <tur@semihalf.com>

Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.

# 77ddac94 13-Oct-2005 Wolfgang Denk <wd@denx.de>

Cleanup for GCC-4.x

# 460c322f 03-Aug-2005 Wolfgang Denk <wd@denx.de>

(re)enabled scsi commands do_scsi() and do_scsiboot()
Patch by Denis Peter, 06 Dec 2004

# 095b8a37 02-Aug-2005 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# 9c998aa8 21-Jul-2005 Wolfgang Denk <wd@denx.de>

Fix low-level OHCI transfers for ARM920t and MPC5xxx

A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.

# 2729af9d 03-May-2004 Wolfgang Denk <wd@denx.de>

* Fix minor NAND JFFS2 related issue

* Fixes for SL811 USB controller:
- implement workaround for broken memory stick
- improve error handling

* Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better
cope with congested networks.

# f8d813e3 02-Mar-2004 Wolfgang Denk <wd@denx.de>

* Fix SDRAM timings for LITE5200 / IceCube board

* Handle Auti-MDIX / connection status for INCA-IP

* Fix USB problems when attempting to read 0 bytes

# 80885a9d 26-Feb-2004 Wolfgang Denk <wd@denx.de>

* Patch by Markus Pietrek, 24 Feb 2004:
NS9750 DevBoard added

* Patch by Pierre AUBERT, 24 Feb 2004
add USB support for MPC5200

* Patch by Steven Scholz, 24 Feb 2004:
- fix MII commands to use values from last command

* Patch by Torsten Demke, 24 Feb 2004:
Add support for the eXalion platform (SPSW-8240, F-30, F-300)

# f54ebdfa 17-Sep-2003 Wolfgang Denk <wd@denx.de>

Add auto-update code for TRAB board using USB memory sticks

# a43278a4 11-Sep-2003 Wolfgang Denk <wd@denx.de>

* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices

* Patch by Denis Peter, 11 Sep 2003:
- fix USB data pointer assignment for bulk only transfer.
- prevent to display erased directories in FAT filesystem.

* Change output format for NAND flash - make it look like for other
memory, too

# 149dded2 10-Sep-2003 Wolfgang Denk <wd@denx.de>

* Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD

# 8bde7f77 27-Jun-2003 Wolfgang Denk <wd@denx.de>

* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)

# affae2bf 17-Aug-2002 Wolfgang Denk <wd@denx.de>

Initial revision

# a79fc7a7 27-Apr-2024 Tom Rini <trini@konsulko.com>

common: Remove <common.h> and add needed includes

Remove <common.h> from all "commmon/" files and when needed add
missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 75aabe59 29-Oct-2023 Hector Martin <marcan@marcan.st>

usb: storage: Use the correct CBW lengths

USB UFI uses fixed 12-byte commands (as does RBC, which is not
supported), but SCSI does not have this limitation. Use the correct
command block lengths depending on the subclass.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7020b2ec 26-Sep-2023 Bin Meng <bmeng@tinylab.org>

blk: Use a macro for the typical block size

Avoid using the magic number 512 directly.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d7d78576 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Rename bootdev_setup_sibling_blk()

This name is a little confusing since it suggests that it sets up the
sibling block device. In fact it sets up a bootdev for it. Rename the
function to make this clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 04448899 04-Nov-2022 Janne Grunau <j@jannau.net>

usb: storage: continue probe on "Invalid device"

Fixes a crash during probing of sd card readers without medium present.
Seen with the device below but reported for many other devices.

idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x0326 Card reader
bcdDevice 11.24
iManufacturer 1 Realtek
iProduct 2 USB3.0 Card Reader
iSerial 3 201404081410

Link: https://github.com/AsahiLinux/linux/issues/44
Link: https://lists.denx.de/pipermail/u-boot/2022-July/489717.html

Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 8149b150 17-Sep-2022 Simon Glass <sjg@chromium.org>

blk: Rename if_type to uclass_id

Use the word 'uclass' instead of 'if_type' to complete the conversion.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ccb0ac5 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: usb: Add a bootdev driver

Add a bootdev driver for USB host. It can use the distro boot mechanism to
locate a file, or any other available bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8c9812a5 08-Mar-2022 AKASHI Takahiro <akashi.tkhro@gmail.com>

usb: storage: call device_probe() after scanning

Every time a usb bus/port is scanned and a new device is detected,
we want to call device_probe() as it will give us a chance to run
additional post-processings for some purposes.

In particular, support for creating partitions on a device will be added.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0cf207ec 27-Sep-2021 Wolfgang Denk <wd@denx.de>

WS cleanup: remove SPACE(s) followed by TAB

Signed-off-by: Wolfgang Denk <wd@denx.de>

# bc0b99bd 06-Jan-2021 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2021.04

arm64:
- DT updates

microblaze:
- Add support for NOR device support

spi:
- Fix unaligned data write issue

nand:
- Minor code change

xilinx:
- Fru fix in limit calculation
- Fill git repo link for all Xilinx boards

video:
- Add support for seps525 spi display

tools:
- Minor Vitis file support

cmd/common
- Minor code indentation fixes

serial:
- Uartlite debug uart initialization fix


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@amd.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31232de0 06-Apr-2020 Marek Vasut <marex@denx.de>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]

# da3d1c49 05-Oct-2019 Marek Vasut <marex@denx.de>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 7d6fd7f0 15-Sep-2019 Marek Vasut <marex@denx.de>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# d0851c89 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dee37fc9 06-Aug-2018 Masahiro Yamada <masahiroy@kernel.org>

Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

typedef unsigned int u32;
typedef unsigned long uintptr_t;
typedef unsigned long long u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly. You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 72ac8f3f 27-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# ea7fad91 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled

When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 6158d0b4 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Refactor to use max_xfer_blk from struct us_data

This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# b9560ad6 14-Jun-2017 Simon Glass <sjg@chromium.org>

dm: scsi: Drop the ccb typedef

We should not be using typedefs in U-Boot and 'ccb' is a pretty short
name. It is also used with variables. Drop the typedef and use 'struct'
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8850c5d5 12-May-2017 Tom Rini <trini@konsulko.com>

Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1e5eca7d 10-Apr-2017 Troy Kisky <troy.kisky@boundarydevices.com>

usb: return 0 from usb_stor_get_info even if removable media

This fixes a regression caused by

commit 07b2b78ce4bc8ae25e066c65245eaf58c0d9a67c
dm: usb: Convert USB storage to use driver-model for block devs

which caused part_init to be called when it was not previously.
Without this patch, the following happens when a USB sd card reader is used.

=> usb start
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1 for devices... 3 USB Device(s) found
scanning usb for storage devices... Device NOT ready
Request Sense returned 02 3A 00
### ERROR ### Please RESET the board ###

This happens because dev_desc->blksz is 0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

# b984700c 21-Dec-2016 Michal Simek <michal.simek@amd.com>

usb: storage: Show number of storage devices detected for DM_USB

By enabling DM_USB information about number of storage devices
was lost.
Get this information back simply by printing number of devices detected
via BLK uclass.

For example:
scanning bus 0 for devices... 7 USB Device(s) found
scanning usb for storage devices... 3 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 8319aeb1 06-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9107c973 01-May-2016 Simon Glass <sjg@chromium.org>

dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 57ebf67b 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0543bf6 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b94fc851 16-Mar-2016 Simon Glass <sjg@chromium.org>

usb: Correct return value in usb_stor_info()

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# a6f70a3d 15-Mar-2016 Vagrant Cascadian <vagrant@debian.org>

Fix spelling of "transferred".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 07b2b78c 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Convert USB storage to use driver-model for block devs

Update this code to support CONFIG_BLK. Each USB storage device can have
one or more block devices as children, each one representing a LUN
(logical unit) of the USB device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 9807c3b7 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Tidy up storage code ready for driver model conversion

Adjust a few things so that the addition of driver-models support involved
adding code rather than also changing it. This makes the patches easier to
review.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c89e79d4 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Avoid exceeding available array size for storage devices

The limit on storage devices is USB_MAX_STOR_DEV but we use one extra
element while probing to see if a device is a storage device. Avoid this,
since it causes memory corruption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# bcce53d0 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 3e8bd469 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: part: Rename some partition functions

Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4101f687 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: Drop the block_dev_desc_t typedef

Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4ef79099 07-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7c4213f6 07-Dec-2015 Stephen Warren <swarren@nvidia.com>

block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 70caa971 03-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Allow up to 7 storage devices

The current limit of 5 is not enough for the driver model USB tests. Really
we should not have a limit but the driver model code still uses the
usb_dev_desc[] array, which has a limit.

Increasing the limit by 2 should not bother anyone. Adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f5fb78a2 11-Oct-2015 Tom Rini <trini@konsulko.com>

common/usb_storage.c: Clean up usb_storage_probe()

We have the protocol and subclass variables which are used only in
disabled debug code. This code dates back to the initial git import and
seemingly dead code so remove it.

This was detected by Coverity (CID 131117)

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcbe3d15 28-Sep-2015 Simon Glass <sjg@chromium.org>

dm: Rename dev_get_parentdata() to dev_get_parent_priv()

The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

# cf92e05c 02-Sep-2015 Simon Glass <sjg@chromium.org>

Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header

Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# abb59cff 06-Jul-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust the USB_DEVICE() macro naming

In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
We should follow the same convention in U-Boot. Rename the existing
USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
macro from Linux for use in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>

# acf277af 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Convert usb_storage to driver model

Add support for scanning USB storage devices with driver model. This mostly
involves adding a USB device ID for storage devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 91557579 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move storage device scanning into its own function

The usb_stor_scan() function is quite long, so split out the code that scans
each device into its own function. Also, rather than setting up the block
device list once at the start, set it up as each device is scanned. This
makes it possible to use this code from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7fc2c1ea 16-Apr-2015 Simon Glass <sjg@chromium.org>

Revert "usb_storage : scan all interfaces to find a storage device"

This reverts commit cd749658d5994978579628a6333e5c2a6c8ec632.

The conflicts with this commit are hard for me to figure out. I will re-apply
it later.

# 05108132 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust usb_storage to work with sandbox

With a few tweaks we can compile this code with sandbox and enable testing
of the USB storage layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 84073b6f 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Simply device finding code in usb_storage

The for() loop is not needed since the value is immediately accessible.
Use this instead to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1d5827a1 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2e17c87e 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move USB storage definitions to usb_defs.h

These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f6570871 01-Apr-2015 Sergey Temerkhanov <s.temerkhanov@gmail.com>

usb_storage:Fix USB storage capacity detection on 64 bit architectures

This patch fixes USB storage capacity detection breakage on 64-bit systems
which arises due to 'unsigned long' length difference. Old code assumes that
to be 32 bit and breaks because of inappropriate response buffer layout.
Also this fixes a number of build warnings and changes big-endian values
treatment style to be architecture-independent

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>

# cd749658 04-Mar-2015 Franck Jullien <franck.jullien@gmail.com>

usb_storage : scan all interfaces to find a storage device

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>

# 6a559bbe 07-Nov-2014 Soeren Moch <smoch@web.de>

usb_storage: blacklist Enclosure Service Devices

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>

# 4fd074de 15-Oct-2014 Simon Glass <sjg@chromium.org>

usb: Use correct printf() format string for uintptr_t

Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ff8fef56 14-Jun-2013 Sascha Silbe <t-uboot@infra-silbe.de>

Fix block device accesses beyond 2TiB

With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>

# 605bd75a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

USB: Some cleanup prior to USB 3.0 interface addition

Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# ceb4972a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

usb: common: Weed out USB_**_PRINTFs from usb framework

USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# 0472fbfd 09-Apr-2013 Egbert Eich <eich@suse.com>

part/dev_desc: Add log2 of blocksize to block_dev_desc data struct

log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>

# 8b57e2f0 12-Dec-2012 Vincent Palatin <vpalatin@chromium.org>

usb: properly detect empty mass storage media reader

When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 199adb60 29-Oct-2012 Kim Phillips <kim.phillips@freescale.com>

common/misc: sparse fixes

command.c:44:38: error: bad constant expression
dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
hush.c:2175:20: warning: Using plain integer as NULL pointer
hush.c:2175:34: warning: Using plain integer as NULL pointer
hush.c:2210:41: warning: Using plain integer as NULL pointer
hush.c:2216:45: warning: Using plain integer as NULL pointer
hush.c:2249:25: warning: Using plain integer as NULL pointer
hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
hush.c:3295:34: warning: Using plain integer as NULL pointer
hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
image.c:1282:29: warning: Using plain integer as NULL pointer
image.c:1315:41: warning: Using plain integer as NULL pointer
image.c:1330:25: warning: Using plain integer as NULL pointer
image.c:1706:25: warning: Using plain integer as NULL pointer
main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
usb_storage.c:440:48: warning: Using plain integer as NULL pointer
usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
usb_storage.c:629:55: warning: Using plain integer as NULL pointer
usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
usb_storage.c:675:43: warning: Using plain integer as NULL pointer
usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

note: hush.c's nesting_level deleted because not used.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# e81e79ed 12-Oct-2012 Gabe Black <gabeblack@chromium.org>

usb: Support the CONFIG_SYS_64BIT_LBA option

usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 93c2582f 25-Sep-2012 Lucas Stach <dev@lynxeye.de>

usb: add support for multiple usb controllers

Allows to initialize more than one USB controller at once.

v2: print message when controller stop fails

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>

# b7006958 30-Jul-2012 Jim Shimer <jamesshimer@motorola.com>

usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

# 3e8581bb 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
- Rebase against the latest u-boot-usb master.
- Replace typedef with #define.
- Use the existing flags struct field instead of adding a new field.
- Remove the setter function.
- Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>

# 4bee5c83 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# cffcc503 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# 1b4bd0e6 09-Jul-2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

usb_storage: fix ehci driver max transfer size

The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage:
Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in
usb_storage as it wrongly assumes that every transfer can use
4096 bytes per qt_buffer. This is wrong if the start address of
the data is not page aligned to 4096 bytes and leads to 'EHCI
timed out on TD' messages because of 'out of buffer pointers'
in ehci_td_buffer function.

The bug appears during load of a fragmented file and
read from or write to an unaligned memory address.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# f5766139 03-Apr-2012 Puneet Saxena <puneets@nvidia.com>

USB: Align buffers at cacheline

This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>

# 5b84dd67 05-Mar-2012 Mike Frysinger <vapier@gentoo.org>

usb: replace wait_ms() with mdelay()

Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>

# 5dd95cf9 21-Dec-2011 Kyle Moffett <Kyle.D.Moffett@boeing.com>

usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

# 4b210e8b 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash subsequent warnings in usb_storage.c

usb_storage.c: In function ‘us_one_transfer’:
usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_reset’:
usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_comdat’:
usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_transport’:
usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_transport’:
usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Remy Bohmer <linux@bohmer.net>

# 86bd3ff8 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash warning in usb_storage.c

usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>

# f092f15d 04-Oct-2011 Wolfgang Denk <wd@denx.de>

Revert "GCC4.6: Convert various empty macros to inline functions"

This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac.

The commit causes build breakage for a number of boards. This results
from the fact that now the arguments of debug() actually get
referenced (even if there is hope that the compiler will optimize
away the debug() call). The obvious fix to that probem (change the
code to always declare the referenced variables and data structures)
increases the code size, and was this rejected. So it was decided to
revert this commit until a better solution is found.

# 60ce53cf 26-Sep-2011 Marek Vasut <marex@denx.de>

GCC4.6: Convert various empty macros to inline functions

Fix the following gcc4.6 problems:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]
asix.c: In function ‘asix_init’:
asix.c:317:6: warning: variable ‘rx_ctl’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_parse_config’:
usb.c:331:17: warning: variable ‘ch’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_port_connect_change’:
usb.c:1123:29: warning: variable ‘portchange’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_configure’:
usb.c:1183:25: warning: variable ‘hubsts’ set but not used
[-Wunused-but-set-variable]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>

# df3fc526 23-May-2011 Matthew McClintock <msm@freescale.com>

disk/part.c: Make features optional

If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>

# 6052cbab 03-Feb-2011 Loïc Minier <loic.minier@linaro.org>

Fix misc spelling errors found by lintian

Signed-off-by: Lo�c Minier <loic.minier@linaro.org>

# 56887e27 24-Mar-2011 Erik Hansen <erik@makarta.com>

Remove unnecessary reset in usb_stor_get_info

The reset request in usb_stor_get_info is causing issues with some usb
sticks. Some of these sticks vendor_id/product_id have been hardcoded to
not reset but better is to remove the reset altogether. It is not needed.

Signed-off-by: Erik Hansen <erik@makarta.com>

# 2ff12285 20-Oct-2010 Mike Frysinger <vapier@gentoo.org>

usb_storage: constify us_direction lookup table

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 99e9ed1f 05-Oct-2010 Ludovic Courtès <ludo@gnu.org>

usb: Add support for multiple-LUN mass storage devices

This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device. It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>

# 226fa9bb 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: change progress output in debug() message

The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
. <<==== here
29 file.001
29 file.002
29 file.003
29 file.004
29 file.005
29 file.006
29 file.007
29 file.008
29 file.009
29 file.010
29 file.011
29 file.012
29 file.013
29 file.014
29 file.015
29 file.016
. <<==== here
29 file.017
29 file.018
29 file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# a17c548b 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: initialize device type

The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

=> usb part
print_part of 0

Partition Map for USB device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 0 2031616 f8

print_part of 1
## Unknown partition table

print_part of 2
## Unknown partition table

print_part of 3
## Unknown partition table

print_part of 4
## Unknown partition table
=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# fac71cc4 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage probe

While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# aaad108b 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage count

Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# 127e1084 02-Nov-2009 Mahavir Jain <mjain@marvell.com>

usb: write command for RAW partition.

This patch implements write support to usb device with raw partition.
It will be useful for filesystem write support to usb device from
u-boot in future.

Tested with writing kernel image to raw usb disk & booting with usb
read command into ram.

[Note: run usb part to get info about start sector & number of
sectors on a partition for usb write operation.]

Signed-off-by: Mahavir Jain <mjain@marvell.com>

# 8f8bd565 30-Oct-2009 Tom Rix <Tom.Rix@windriver.com>

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

unsigned char bRefresh
unsigned char bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h. The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>

# 792a09eb 13-May-2009 Detlev Zundel <dzu@denx.de>

Fix e-mail address of Gary Jennejohn.

Signed-off-by: Detlev Zundel <dzu@denx.de>

# 9704f9ca 28-Oct-2008 Abraham, Thomas <t-abraham@ti.com>

USB: Remove LUN number from CDB

The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB.

Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# c7d703f3 01-Jan-2009 Mike Frysinger <vapier@gentoo.org>

usb.h: use standard __LITTLE_ENDIAN from Linux headers

Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# 14e4111c 01-Jan-2009 Bryan Wu <Bryan.Wu@analog.com>

usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb drive

The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4
does not like to be reset, so check for it.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# a0cb3fc3 10-Dec-2008 Michael Trimarchi <trimarchi@gandalf.sssup.it>

USB storage cleanup patch

Cleanup usb storage

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# d6e9ee92 12-Aug-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

common: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# d0ff51ba 14-Jul-2008 Wolfgang Denk <wd@denx.de>

Code cleanup: fix old style assignment ambiguities like "=-" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c918261c 21-May-2008 Christian Eggers <ceggers@gmx.de>

USB: replace old swap_ with proper endianess conversion macros

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 1aeed8d7 13-Apr-2008 Wolfgang Denk <wd@denx.de>

Coding Style cleanup; update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b9e749e9 26-Mar-2008 Markus Klotzbuecher <mk@denx.de>

USB, Storage: fix a bug introduced in commit
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info
to only print only information on one storage device, but not for
multiple.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# f6b44e0e 24-Mar-2008 Aras Vaichas <arasv@magtech.com.au>

USB Storage, add meaningful return value

This patch changes the "usb storage" command to return success if it
finds a USB storage device, otherwise it returns error.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 409ecdc0 18-Nov-2007 Wolfgang Denk <wd@denx.de>

Fix compiler warnings for PPC systems. Update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 90253178 10-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/: Remove lingering references to CFG_CMD_* symbols.

Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# c3517f91 08-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDS

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# b453960d 11-Jun-2007 Jon Loeliger <jdl@jdl.com>

common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).

This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# eb867a76 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers

Block device read/write is anonymous data; there is no need to use a
typed pointer. void * is fine. Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 735dd97b 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 1_4] Merge common get_dev() routines for block devices

Each of the filesystem drivers duplicate the get_dev routine. This change
merges them into a single function in part.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 73652699 19-Oct-2006 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# ddde6b7c 22-Aug-2006 Bartlomiej Sieka <tur@semihalf.com>

Add a fix for a buggy USB device on the FO300 board.

# f88a0ae6 13-Jul-2006 Bartlomiej Sieka <tur@semihalf.com>

Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.

# 77ddac94 13-Oct-2005 Wolfgang Denk <wd@denx.de>

Cleanup for GCC-4.x

# 460c322f 03-Aug-2005 Wolfgang Denk <wd@denx.de>

(re)enabled scsi commands do_scsi() and do_scsiboot()
Patch by Denis Peter, 06 Dec 2004

# 095b8a37 02-Aug-2005 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# 9c998aa8 21-Jul-2005 Wolfgang Denk <wd@denx.de>

Fix low-level OHCI transfers for ARM920t and MPC5xxx

A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.

# 2729af9d 03-May-2004 Wolfgang Denk <wd@denx.de>

* Fix minor NAND JFFS2 related issue

* Fixes for SL811 USB controller:
- implement workaround for broken memory stick
- improve error handling

* Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better
cope with congested networks.

# f8d813e3 02-Mar-2004 Wolfgang Denk <wd@denx.de>

* Fix SDRAM timings for LITE5200 / IceCube board

* Handle Auti-MDIX / connection status for INCA-IP

* Fix USB problems when attempting to read 0 bytes

# 80885a9d 26-Feb-2004 Wolfgang Denk <wd@denx.de>

* Patch by Markus Pietrek, 24 Feb 2004:
NS9750 DevBoard added

* Patch by Pierre AUBERT, 24 Feb 2004
add USB support for MPC5200

* Patch by Steven Scholz, 24 Feb 2004:
- fix MII commands to use values from last command

* Patch by Torsten Demke, 24 Feb 2004:
Add support for the eXalion platform (SPSW-8240, F-30, F-300)

# f54ebdfa 17-Sep-2003 Wolfgang Denk <wd@denx.de>

Add auto-update code for TRAB board using USB memory sticks

# a43278a4 11-Sep-2003 Wolfgang Denk <wd@denx.de>

* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices

* Patch by Denis Peter, 11 Sep 2003:
- fix USB data pointer assignment for bulk only transfer.
- prevent to display erased directories in FAT filesystem.

* Change output format for NAND flash - make it look like for other
memory, too

# 149dded2 10-Sep-2003 Wolfgang Denk <wd@denx.de>

* Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD

# 8bde7f77 27-Jun-2003 Wolfgang Denk <wd@denx.de>

* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)

# affae2bf 17-Aug-2002 Wolfgang Denk <wd@denx.de>

Initial revision

# 75aabe59 29-Oct-2023 Hector Martin <marcan@marcan.st>

usb: storage: Use the correct CBW lengths

USB UFI uses fixed 12-byte commands (as does RBC, which is not
supported), but SCSI does not have this limitation. Use the correct
command block lengths depending on the subclass.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7020b2ec 26-Sep-2023 Bin Meng <bmeng@tinylab.org>

blk: Use a macro for the typical block size

Avoid using the magic number 512 directly.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d7d78576 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Rename bootdev_setup_sibling_blk()

This name is a little confusing since it suggests that it sets up the
sibling block device. In fact it sets up a bootdev for it. Rename the
function to make this clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 04448899 04-Nov-2022 Janne Grunau <j@jannau.net>

usb: storage: continue probe on "Invalid device"

Fixes a crash during probing of sd card readers without medium present.
Seen with the device below but reported for many other devices.

idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x0326 Card reader
bcdDevice 11.24
iManufacturer 1 Realtek
iProduct 2 USB3.0 Card Reader
iSerial 3 201404081410

Link: https://github.com/AsahiLinux/linux/issues/44
Link: https://lists.denx.de/pipermail/u-boot/2022-July/489717.html

Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 8149b150 17-Sep-2022 Simon Glass <sjg@chromium.org>

blk: Rename if_type to uclass_id

Use the word 'uclass' instead of 'if_type' to complete the conversion.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ccb0ac5 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: usb: Add a bootdev driver

Add a bootdev driver for USB host. It can use the distro boot mechanism to
locate a file, or any other available bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8c9812a5 08-Mar-2022 AKASHI Takahiro <takahiro.akashi@linaro.org>

usb: storage: call device_probe() after scanning

Every time a usb bus/port is scanned and a new device is detected,
we want to call device_probe() as it will give us a chance to run
additional post-processings for some purposes.

In particular, support for creating partitions on a device will be added.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0cf207ec 27-Sep-2021 Wolfgang Denk <wd@denx.de>

WS cleanup: remove SPACE(s) followed by TAB

Signed-off-by: Wolfgang Denk <wd@denx.de>

# bc0b99bd 06-Jan-2021 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2021.04

arm64:
- DT updates

microblaze:
- Add support for NOR device support

spi:
- Fix unaligned data write issue

nand:
- Minor code change

xilinx:
- Fru fix in limit calculation
- Fill git repo link for all Xilinx boards

video:
- Add support for seps525 spi display

tools:
- Minor Vitis file support

cmd/common
- Minor code indentation fixes

serial:
- Uartlite debug uart initialization fix


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@amd.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31232de0 06-Apr-2020 Marek Vasut <marex@denx.de>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]

# da3d1c49 05-Oct-2019 Marek Vasut <marex@denx.de>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 7d6fd7f0 15-Sep-2019 Marek Vasut <marex@denx.de>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# d0851c89 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dee37fc9 06-Aug-2018 Masahiro Yamada <masahiroy@kernel.org>

Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

typedef unsigned int u32;
typedef unsigned long uintptr_t;
typedef unsigned long long u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly. You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 72ac8f3f 27-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# ea7fad91 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled

When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 6158d0b4 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Refactor to use max_xfer_blk from struct us_data

This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# b9560ad6 14-Jun-2017 Simon Glass <sjg@chromium.org>

dm: scsi: Drop the ccb typedef

We should not be using typedefs in U-Boot and 'ccb' is a pretty short
name. It is also used with variables. Drop the typedef and use 'struct'
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8850c5d5 12-May-2017 Tom Rini <trini@konsulko.com>

Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1e5eca7d 10-Apr-2017 Troy Kisky <troy.kisky@boundarydevices.com>

usb: return 0 from usb_stor_get_info even if removable media

This fixes a regression caused by

commit 07b2b78ce4bc8ae25e066c65245eaf58c0d9a67c
dm: usb: Convert USB storage to use driver-model for block devs

which caused part_init to be called when it was not previously.
Without this patch, the following happens when a USB sd card reader is used.

=> usb start
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1 for devices... 3 USB Device(s) found
scanning usb for storage devices... Device NOT ready
Request Sense returned 02 3A 00
### ERROR ### Please RESET the board ###

This happens because dev_desc->blksz is 0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

# b984700c 21-Dec-2016 Michal Simek <michal.simek@amd.com>

usb: storage: Show number of storage devices detected for DM_USB

By enabling DM_USB information about number of storage devices
was lost.
Get this information back simply by printing number of devices detected
via BLK uclass.

For example:
scanning bus 0 for devices... 7 USB Device(s) found
scanning usb for storage devices... 3 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 8319aeb1 06-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9107c973 01-May-2016 Simon Glass <sjg@chromium.org>

dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 57ebf67b 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0543bf6 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b94fc851 16-Mar-2016 Simon Glass <sjg@chromium.org>

usb: Correct return value in usb_stor_info()

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# a6f70a3d 15-Mar-2016 Vagrant Cascadian <vagrant@debian.org>

Fix spelling of "transferred".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 07b2b78c 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Convert USB storage to use driver-model for block devs

Update this code to support CONFIG_BLK. Each USB storage device can have
one or more block devices as children, each one representing a LUN
(logical unit) of the USB device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 9807c3b7 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Tidy up storage code ready for driver model conversion

Adjust a few things so that the addition of driver-models support involved
adding code rather than also changing it. This makes the patches easier to
review.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c89e79d4 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Avoid exceeding available array size for storage devices

The limit on storage devices is USB_MAX_STOR_DEV but we use one extra
element while probing to see if a device is a storage device. Avoid this,
since it causes memory corruption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# bcce53d0 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 3e8bd469 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: part: Rename some partition functions

Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4101f687 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: Drop the block_dev_desc_t typedef

Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4ef79099 07-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7c4213f6 07-Dec-2015 Stephen Warren <swarren@nvidia.com>

block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 70caa971 03-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Allow up to 7 storage devices

The current limit of 5 is not enough for the driver model USB tests. Really
we should not have a limit but the driver model code still uses the
usb_dev_desc[] array, which has a limit.

Increasing the limit by 2 should not bother anyone. Adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f5fb78a2 11-Oct-2015 Tom Rini <trini@konsulko.com>

common/usb_storage.c: Clean up usb_storage_probe()

We have the protocol and subclass variables which are used only in
disabled debug code. This code dates back to the initial git import and
seemingly dead code so remove it.

This was detected by Coverity (CID 131117)

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcbe3d15 28-Sep-2015 Simon Glass <sjg@chromium.org>

dm: Rename dev_get_parentdata() to dev_get_parent_priv()

The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

# cf92e05c 02-Sep-2015 Simon Glass <sjg@chromium.org>

Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header

Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# abb59cff 06-Jul-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust the USB_DEVICE() macro naming

In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
We should follow the same convention in U-Boot. Rename the existing
USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
macro from Linux for use in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>

# acf277af 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Convert usb_storage to driver model

Add support for scanning USB storage devices with driver model. This mostly
involves adding a USB device ID for storage devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 91557579 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move storage device scanning into its own function

The usb_stor_scan() function is quite long, so split out the code that scans
each device into its own function. Also, rather than setting up the block
device list once at the start, set it up as each device is scanned. This
makes it possible to use this code from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7fc2c1ea 16-Apr-2015 Simon Glass <sjg@chromium.org>

Revert "usb_storage : scan all interfaces to find a storage device"

This reverts commit cd749658d5994978579628a6333e5c2a6c8ec632.

The conflicts with this commit are hard for me to figure out. I will re-apply
it later.

# 05108132 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust usb_storage to work with sandbox

With a few tweaks we can compile this code with sandbox and enable testing
of the USB storage layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 84073b6f 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Simply device finding code in usb_storage

The for() loop is not needed since the value is immediately accessible.
Use this instead to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1d5827a1 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2e17c87e 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move USB storage definitions to usb_defs.h

These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f6570871 01-Apr-2015 Sergey Temerkhanov <s.temerkhanov@gmail.com>

usb_storage:Fix USB storage capacity detection on 64 bit architectures

This patch fixes USB storage capacity detection breakage on 64-bit systems
which arises due to 'unsigned long' length difference. Old code assumes that
to be 32 bit and breaks because of inappropriate response buffer layout.
Also this fixes a number of build warnings and changes big-endian values
treatment style to be architecture-independent

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>

# cd749658 04-Mar-2015 Franck Jullien <franck.jullien@gmail.com>

usb_storage : scan all interfaces to find a storage device

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>

# 6a559bbe 07-Nov-2014 Soeren Moch <smoch@web.de>

usb_storage: blacklist Enclosure Service Devices

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>

# 4fd074de 15-Oct-2014 Simon Glass <sjg@chromium.org>

usb: Use correct printf() format string for uintptr_t

Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ff8fef56 14-Jun-2013 Sascha Silbe <t-uboot@infra-silbe.de>

Fix block device accesses beyond 2TiB

With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>

# 605bd75a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

USB: Some cleanup prior to USB 3.0 interface addition

Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# ceb4972a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

usb: common: Weed out USB_**_PRINTFs from usb framework

USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# 0472fbfd 09-Apr-2013 Egbert Eich <eich@suse.com>

part/dev_desc: Add log2 of blocksize to block_dev_desc data struct

log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>

# 8b57e2f0 12-Dec-2012 Vincent Palatin <vpalatin@chromium.org>

usb: properly detect empty mass storage media reader

When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 199adb60 29-Oct-2012 Kim Phillips <kim.phillips@freescale.com>

common/misc: sparse fixes

command.c:44:38: error: bad constant expression
dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
hush.c:2175:20: warning: Using plain integer as NULL pointer
hush.c:2175:34: warning: Using plain integer as NULL pointer
hush.c:2210:41: warning: Using plain integer as NULL pointer
hush.c:2216:45: warning: Using plain integer as NULL pointer
hush.c:2249:25: warning: Using plain integer as NULL pointer
hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
hush.c:3295:34: warning: Using plain integer as NULL pointer
hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
image.c:1282:29: warning: Using plain integer as NULL pointer
image.c:1315:41: warning: Using plain integer as NULL pointer
image.c:1330:25: warning: Using plain integer as NULL pointer
image.c:1706:25: warning: Using plain integer as NULL pointer
main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
usb_storage.c:440:48: warning: Using plain integer as NULL pointer
usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
usb_storage.c:629:55: warning: Using plain integer as NULL pointer
usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
usb_storage.c:675:43: warning: Using plain integer as NULL pointer
usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

note: hush.c's nesting_level deleted because not used.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# e81e79ed 12-Oct-2012 Gabe Black <gabeblack@chromium.org>

usb: Support the CONFIG_SYS_64BIT_LBA option

usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 93c2582f 25-Sep-2012 Lucas Stach <dev@lynxeye.de>

usb: add support for multiple usb controllers

Allows to initialize more than one USB controller at once.

v2: print message when controller stop fails

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>

# b7006958 30-Jul-2012 Jim Shimer <jamesshimer@motorola.com>

usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

# 3e8581bb 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
- Rebase against the latest u-boot-usb master.
- Replace typedef with #define.
- Use the existing flags struct field instead of adding a new field.
- Remove the setter function.
- Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>

# 4bee5c83 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# cffcc503 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# 1b4bd0e6 09-Jul-2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

usb_storage: fix ehci driver max transfer size

The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage:
Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in
usb_storage as it wrongly assumes that every transfer can use
4096 bytes per qt_buffer. This is wrong if the start address of
the data is not page aligned to 4096 bytes and leads to 'EHCI
timed out on TD' messages because of 'out of buffer pointers'
in ehci_td_buffer function.

The bug appears during load of a fragmented file and
read from or write to an unaligned memory address.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# f5766139 03-Apr-2012 Puneet Saxena <puneets@nvidia.com>

USB: Align buffers at cacheline

This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>

# 5b84dd67 05-Mar-2012 Mike Frysinger <vapier@gentoo.org>

usb: replace wait_ms() with mdelay()

Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>

# 5dd95cf9 21-Dec-2011 Kyle Moffett <Kyle.D.Moffett@boeing.com>

usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

# 4b210e8b 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash subsequent warnings in usb_storage.c

usb_storage.c: In function ‘us_one_transfer’:
usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_reset’:
usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_comdat’:
usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_transport’:
usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_transport’:
usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Remy Bohmer <linux@bohmer.net>

# 86bd3ff8 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash warning in usb_storage.c

usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>

# f092f15d 04-Oct-2011 Wolfgang Denk <wd@denx.de>

Revert "GCC4.6: Convert various empty macros to inline functions"

This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac.

The commit causes build breakage for a number of boards. This results
from the fact that now the arguments of debug() actually get
referenced (even if there is hope that the compiler will optimize
away the debug() call). The obvious fix to that probem (change the
code to always declare the referenced variables and data structures)
increases the code size, and was this rejected. So it was decided to
revert this commit until a better solution is found.

# 60ce53cf 26-Sep-2011 Marek Vasut <marex@denx.de>

GCC4.6: Convert various empty macros to inline functions

Fix the following gcc4.6 problems:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]
asix.c: In function ‘asix_init’:
asix.c:317:6: warning: variable ‘rx_ctl’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_parse_config’:
usb.c:331:17: warning: variable ‘ch’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_port_connect_change’:
usb.c:1123:29: warning: variable ‘portchange’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_configure’:
usb.c:1183:25: warning: variable ‘hubsts’ set but not used
[-Wunused-but-set-variable]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>

# df3fc526 23-May-2011 Matthew McClintock <msm@freescale.com>

disk/part.c: Make features optional

If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>

# 6052cbab 03-Feb-2011 Loïc Minier <loic.minier@linaro.org>

Fix misc spelling errors found by lintian

Signed-off-by: Lo�c Minier <loic.minier@linaro.org>

# 56887e27 24-Mar-2011 Erik Hansen <erik@makarta.com>

Remove unnecessary reset in usb_stor_get_info

The reset request in usb_stor_get_info is causing issues with some usb
sticks. Some of these sticks vendor_id/product_id have been hardcoded to
not reset but better is to remove the reset altogether. It is not needed.

Signed-off-by: Erik Hansen <erik@makarta.com>

# 2ff12285 20-Oct-2010 Mike Frysinger <vapier@gentoo.org>

usb_storage: constify us_direction lookup table

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 99e9ed1f 05-Oct-2010 Ludovic Courtès <ludo@gnu.org>

usb: Add support for multiple-LUN mass storage devices

This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device. It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>

# 226fa9bb 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: change progress output in debug() message

The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
. <<==== here
29 file.001
29 file.002
29 file.003
29 file.004
29 file.005
29 file.006
29 file.007
29 file.008
29 file.009
29 file.010
29 file.011
29 file.012
29 file.013
29 file.014
29 file.015
29 file.016
. <<==== here
29 file.017
29 file.018
29 file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# a17c548b 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: initialize device type

The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

=> usb part
print_part of 0

Partition Map for USB device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 0 2031616 f8

print_part of 1
## Unknown partition table

print_part of 2
## Unknown partition table

print_part of 3
## Unknown partition table

print_part of 4
## Unknown partition table
=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# fac71cc4 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage probe

While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# aaad108b 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage count

Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# 127e1084 02-Nov-2009 Mahavir Jain <mjain@marvell.com>

usb: write command for RAW partition.

This patch implements write support to usb device with raw partition.
It will be useful for filesystem write support to usb device from
u-boot in future.

Tested with writing kernel image to raw usb disk & booting with usb
read command into ram.

[Note: run usb part to get info about start sector & number of
sectors on a partition for usb write operation.]

Signed-off-by: Mahavir Jain <mjain@marvell.com>

# 8f8bd565 30-Oct-2009 Tom Rix <Tom.Rix@windriver.com>

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

unsigned char bRefresh
unsigned char bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h. The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>

# 792a09eb 13-May-2009 Detlev Zundel <dzu@denx.de>

Fix e-mail address of Gary Jennejohn.

Signed-off-by: Detlev Zundel <dzu@denx.de>

# 9704f9ca 28-Oct-2008 Abraham, Thomas <t-abraham@ti.com>

USB: Remove LUN number from CDB

The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB.

Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# c7d703f3 01-Jan-2009 Mike Frysinger <vapier@gentoo.org>

usb.h: use standard __LITTLE_ENDIAN from Linux headers

Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# 14e4111c 01-Jan-2009 Bryan Wu <Bryan.Wu@analog.com>

usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb drive

The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4
does not like to be reset, so check for it.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# a0cb3fc3 10-Dec-2008 Michael Trimarchi <trimarchi@gandalf.sssup.it>

USB storage cleanup patch

Cleanup usb storage

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# d6e9ee92 12-Aug-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

common: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# d0ff51ba 14-Jul-2008 Wolfgang Denk <wd@denx.de>

Code cleanup: fix old style assignment ambiguities like "=-" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c918261c 21-May-2008 Christian Eggers <ceggers@gmx.de>

USB: replace old swap_ with proper endianess conversion macros

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 1aeed8d7 13-Apr-2008 Wolfgang Denk <wd@denx.de>

Coding Style cleanup; update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b9e749e9 26-Mar-2008 Markus Klotzbuecher <mk@denx.de>

USB, Storage: fix a bug introduced in commit
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info
to only print only information on one storage device, but not for
multiple.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# f6b44e0e 24-Mar-2008 Aras Vaichas <arasv@magtech.com.au>

USB Storage, add meaningful return value

This patch changes the "usb storage" command to return success if it
finds a USB storage device, otherwise it returns error.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 409ecdc0 18-Nov-2007 Wolfgang Denk <wd@denx.de>

Fix compiler warnings for PPC systems. Update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 90253178 10-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/: Remove lingering references to CFG_CMD_* symbols.

Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# c3517f91 08-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDS

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# b453960d 11-Jun-2007 Jon Loeliger <jdl@jdl.com>

common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).

This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# eb867a76 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers

Block device read/write is anonymous data; there is no need to use a
typed pointer. void * is fine. Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 735dd97b 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 1_4] Merge common get_dev() routines for block devices

Each of the filesystem drivers duplicate the get_dev routine. This change
merges them into a single function in part.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 73652699 19-Oct-2006 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# ddde6b7c 22-Aug-2006 Bartlomiej Sieka <tur@semihalf.com>

Add a fix for a buggy USB device on the FO300 board.

# f88a0ae6 13-Jul-2006 Bartlomiej Sieka <tur@semihalf.com>

Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.

# 77ddac94 13-Oct-2005 Wolfgang Denk <wd@denx.de>

Cleanup for GCC-4.x

# 460c322f 03-Aug-2005 Wolfgang Denk <wd@denx.de>

(re)enabled scsi commands do_scsi() and do_scsiboot()
Patch by Denis Peter, 06 Dec 2004

# 095b8a37 02-Aug-2005 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# 9c998aa8 21-Jul-2005 Wolfgang Denk <wd@denx.de>

Fix low-level OHCI transfers for ARM920t and MPC5xxx

A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.

# 2729af9d 03-May-2004 Wolfgang Denk <wd@denx.de>

* Fix minor NAND JFFS2 related issue

* Fixes for SL811 USB controller:
- implement workaround for broken memory stick
- improve error handling

* Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better
cope with congested networks.

# f8d813e3 02-Mar-2004 Wolfgang Denk <wd@denx.de>

* Fix SDRAM timings for LITE5200 / IceCube board

* Handle Auti-MDIX / connection status for INCA-IP

* Fix USB problems when attempting to read 0 bytes

# 80885a9d 26-Feb-2004 Wolfgang Denk <wd@denx.de>

* Patch by Markus Pietrek, 24 Feb 2004:
NS9750 DevBoard added

* Patch by Pierre AUBERT, 24 Feb 2004
add USB support for MPC5200

* Patch by Steven Scholz, 24 Feb 2004:
- fix MII commands to use values from last command

* Patch by Torsten Demke, 24 Feb 2004:
Add support for the eXalion platform (SPSW-8240, F-30, F-300)

# f54ebdfa 17-Sep-2003 Wolfgang Denk <wd@denx.de>

Add auto-update code for TRAB board using USB memory sticks

# a43278a4 11-Sep-2003 Wolfgang Denk <wd@denx.de>

* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices

* Patch by Denis Peter, 11 Sep 2003:
- fix USB data pointer assignment for bulk only transfer.
- prevent to display erased directories in FAT filesystem.

* Change output format for NAND flash - make it look like for other
memory, too

# 149dded2 10-Sep-2003 Wolfgang Denk <wd@denx.de>

* Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD

# 8bde7f77 27-Jun-2003 Wolfgang Denk <wd@denx.de>

* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)

# affae2bf 17-Aug-2002 Wolfgang Denk <wd@denx.de>

Initial revision

# 7020b2ec 26-Sep-2023 Bin Meng <bmeng@tinylab.org>

blk: Use a macro for the typical block size

Avoid using the magic number 512 directly.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d7d78576 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Rename bootdev_setup_sibling_blk()

This name is a little confusing since it suggests that it sets up the
sibling block device. In fact it sets up a bootdev for it. Rename the
function to make this clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 04448899 04-Nov-2022 Janne Grunau <j@jannau.net>

usb: storage: continue probe on "Invalid device"

Fixes a crash during probing of sd card readers without medium present.
Seen with the device below but reported for many other devices.

idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x0326 Card reader
bcdDevice 11.24
iManufacturer 1 Realtek
iProduct 2 USB3.0 Card Reader
iSerial 3 201404081410

Link: https://github.com/AsahiLinux/linux/issues/44
Link: https://lists.denx.de/pipermail/u-boot/2022-July/489717.html

Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 8149b150 17-Sep-2022 Simon Glass <sjg@chromium.org>

blk: Rename if_type to uclass_id

Use the word 'uclass' instead of 'if_type' to complete the conversion.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ccb0ac5 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: usb: Add a bootdev driver

Add a bootdev driver for USB host. It can use the distro boot mechanism to
locate a file, or any other available bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8c9812a5 08-Mar-2022 AKASHI Takahiro <takahiro.akashi@linaro.org>

usb: storage: call device_probe() after scanning

Every time a usb bus/port is scanned and a new device is detected,
we want to call device_probe() as it will give us a chance to run
additional post-processings for some purposes.

In particular, support for creating partitions on a device will be added.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0cf207ec 27-Sep-2021 Wolfgang Denk <wd@denx.de>

WS cleanup: remove SPACE(s) followed by TAB

Signed-off-by: Wolfgang Denk <wd@denx.de>

# bc0b99bd 06-Jan-2021 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2021.04

arm64:
- DT updates

microblaze:
- Add support for NOR device support

spi:
- Fix unaligned data write issue

nand:
- Minor code change

xilinx:
- Fru fix in limit calculation
- Fill git repo link for all Xilinx boards

video:
- Add support for seps525 spi display

tools:
- Minor Vitis file support

cmd/common
- Minor code indentation fixes

serial:
- Uartlite debug uart initialization fix


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@amd.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31232de0 06-Apr-2020 Marek Vasut <marex@denx.de>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]

# da3d1c49 05-Oct-2019 Marek Vasut <marex@denx.de>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 7d6fd7f0 15-Sep-2019 Marek Vasut <marex@denx.de>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# d0851c89 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dee37fc9 06-Aug-2018 Masahiro Yamada <masahiroy@kernel.org>

Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

typedef unsigned int u32;
typedef unsigned long uintptr_t;
typedef unsigned long long u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly. You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 72ac8f3f 27-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# ea7fad91 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled

When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 6158d0b4 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Refactor to use max_xfer_blk from struct us_data

This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# b9560ad6 14-Jun-2017 Simon Glass <sjg@chromium.org>

dm: scsi: Drop the ccb typedef

We should not be using typedefs in U-Boot and 'ccb' is a pretty short
name. It is also used with variables. Drop the typedef and use 'struct'
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8850c5d5 12-May-2017 Tom Rini <trini@konsulko.com>

Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1e5eca7d 10-Apr-2017 Troy Kisky <troy.kisky@boundarydevices.com>

usb: return 0 from usb_stor_get_info even if removable media

This fixes a regression caused by

commit 07b2b78ce4bc8ae25e066c65245eaf58c0d9a67c
dm: usb: Convert USB storage to use driver-model for block devs

which caused part_init to be called when it was not previously.
Without this patch, the following happens when a USB sd card reader is used.

=> usb start
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1 for devices... 3 USB Device(s) found
scanning usb for storage devices... Device NOT ready
Request Sense returned 02 3A 00
### ERROR ### Please RESET the board ###

This happens because dev_desc->blksz is 0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

# b984700c 21-Dec-2016 Michal Simek <michal.simek@amd.com>

usb: storage: Show number of storage devices detected for DM_USB

By enabling DM_USB information about number of storage devices
was lost.
Get this information back simply by printing number of devices detected
via BLK uclass.

For example:
scanning bus 0 for devices... 7 USB Device(s) found
scanning usb for storage devices... 3 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 8319aeb1 06-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9107c973 01-May-2016 Simon Glass <sjg@chromium.org>

dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 57ebf67b 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0543bf6 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b94fc851 16-Mar-2016 Simon Glass <sjg@chromium.org>

usb: Correct return value in usb_stor_info()

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# a6f70a3d 15-Mar-2016 Vagrant Cascadian <vagrant@debian.org>

Fix spelling of "transferred".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 07b2b78c 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Convert USB storage to use driver-model for block devs

Update this code to support CONFIG_BLK. Each USB storage device can have
one or more block devices as children, each one representing a LUN
(logical unit) of the USB device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 9807c3b7 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Tidy up storage code ready for driver model conversion

Adjust a few things so that the addition of driver-models support involved
adding code rather than also changing it. This makes the patches easier to
review.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c89e79d4 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Avoid exceeding available array size for storage devices

The limit on storage devices is USB_MAX_STOR_DEV but we use one extra
element while probing to see if a device is a storage device. Avoid this,
since it causes memory corruption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# bcce53d0 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 3e8bd469 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: part: Rename some partition functions

Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4101f687 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: Drop the block_dev_desc_t typedef

Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4ef79099 07-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7c4213f6 07-Dec-2015 Stephen Warren <swarren@nvidia.com>

block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 70caa971 03-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Allow up to 7 storage devices

The current limit of 5 is not enough for the driver model USB tests. Really
we should not have a limit but the driver model code still uses the
usb_dev_desc[] array, which has a limit.

Increasing the limit by 2 should not bother anyone. Adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f5fb78a2 11-Oct-2015 Tom Rini <trini@konsulko.com>

common/usb_storage.c: Clean up usb_storage_probe()

We have the protocol and subclass variables which are used only in
disabled debug code. This code dates back to the initial git import and
seemingly dead code so remove it.

This was detected by Coverity (CID 131117)

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcbe3d15 28-Sep-2015 Simon Glass <sjg@chromium.org>

dm: Rename dev_get_parentdata() to dev_get_parent_priv()

The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

# cf92e05c 02-Sep-2015 Simon Glass <sjg@chromium.org>

Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header

Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# abb59cff 06-Jul-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust the USB_DEVICE() macro naming

In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
We should follow the same convention in U-Boot. Rename the existing
USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
macro from Linux for use in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>

# acf277af 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Convert usb_storage to driver model

Add support for scanning USB storage devices with driver model. This mostly
involves adding a USB device ID for storage devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 91557579 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move storage device scanning into its own function

The usb_stor_scan() function is quite long, so split out the code that scans
each device into its own function. Also, rather than setting up the block
device list once at the start, set it up as each device is scanned. This
makes it possible to use this code from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7fc2c1ea 16-Apr-2015 Simon Glass <sjg@chromium.org>

Revert "usb_storage : scan all interfaces to find a storage device"

This reverts commit cd749658d5994978579628a6333e5c2a6c8ec632.

The conflicts with this commit are hard for me to figure out. I will re-apply
it later.

# 05108132 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust usb_storage to work with sandbox

With a few tweaks we can compile this code with sandbox and enable testing
of the USB storage layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 84073b6f 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Simply device finding code in usb_storage

The for() loop is not needed since the value is immediately accessible.
Use this instead to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1d5827a1 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2e17c87e 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move USB storage definitions to usb_defs.h

These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f6570871 01-Apr-2015 Sergey Temerkhanov <s.temerkhanov@gmail.com>

usb_storage:Fix USB storage capacity detection on 64 bit architectures

This patch fixes USB storage capacity detection breakage on 64-bit systems
which arises due to 'unsigned long' length difference. Old code assumes that
to be 32 bit and breaks because of inappropriate response buffer layout.
Also this fixes a number of build warnings and changes big-endian values
treatment style to be architecture-independent

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>

# cd749658 04-Mar-2015 Franck Jullien <franck.jullien@gmail.com>

usb_storage : scan all interfaces to find a storage device

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>

# 6a559bbe 07-Nov-2014 Soeren Moch <smoch@web.de>

usb_storage: blacklist Enclosure Service Devices

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>

# 4fd074de 15-Oct-2014 Simon Glass <sjg@chromium.org>

usb: Use correct printf() format string for uintptr_t

Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ff8fef56 14-Jun-2013 Sascha Silbe <t-uboot@infra-silbe.de>

Fix block device accesses beyond 2TiB

With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>

# 605bd75a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

USB: Some cleanup prior to USB 3.0 interface addition

Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# ceb4972a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

usb: common: Weed out USB_**_PRINTFs from usb framework

USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# 0472fbfd 09-Apr-2013 Egbert Eich <eich@suse.com>

part/dev_desc: Add log2 of blocksize to block_dev_desc data struct

log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>

# 8b57e2f0 12-Dec-2012 Vincent Palatin <vpalatin@chromium.org>

usb: properly detect empty mass storage media reader

When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 199adb60 29-Oct-2012 Kim Phillips <kim.phillips@freescale.com>

common/misc: sparse fixes

command.c:44:38: error: bad constant expression
dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
hush.c:2175:20: warning: Using plain integer as NULL pointer
hush.c:2175:34: warning: Using plain integer as NULL pointer
hush.c:2210:41: warning: Using plain integer as NULL pointer
hush.c:2216:45: warning: Using plain integer as NULL pointer
hush.c:2249:25: warning: Using plain integer as NULL pointer
hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
hush.c:3295:34: warning: Using plain integer as NULL pointer
hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
image.c:1282:29: warning: Using plain integer as NULL pointer
image.c:1315:41: warning: Using plain integer as NULL pointer
image.c:1330:25: warning: Using plain integer as NULL pointer
image.c:1706:25: warning: Using plain integer as NULL pointer
main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
usb_storage.c:440:48: warning: Using plain integer as NULL pointer
usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
usb_storage.c:629:55: warning: Using plain integer as NULL pointer
usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
usb_storage.c:675:43: warning: Using plain integer as NULL pointer
usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

note: hush.c's nesting_level deleted because not used.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# e81e79ed 12-Oct-2012 Gabe Black <gabeblack@chromium.org>

usb: Support the CONFIG_SYS_64BIT_LBA option

usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 93c2582f 25-Sep-2012 Lucas Stach <dev@lynxeye.de>

usb: add support for multiple usb controllers

Allows to initialize more than one USB controller at once.

v2: print message when controller stop fails

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>

# b7006958 30-Jul-2012 Jim Shimer <jamesshimer@motorola.com>

usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

# 3e8581bb 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
- Rebase against the latest u-boot-usb master.
- Replace typedef with #define.
- Use the existing flags struct field instead of adding a new field.
- Remove the setter function.
- Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>

# 4bee5c83 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# cffcc503 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# 1b4bd0e6 09-Jul-2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

usb_storage: fix ehci driver max transfer size

The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage:
Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in
usb_storage as it wrongly assumes that every transfer can use
4096 bytes per qt_buffer. This is wrong if the start address of
the data is not page aligned to 4096 bytes and leads to 'EHCI
timed out on TD' messages because of 'out of buffer pointers'
in ehci_td_buffer function.

The bug appears during load of a fragmented file and
read from or write to an unaligned memory address.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# f5766139 03-Apr-2012 Puneet Saxena <puneets@nvidia.com>

USB: Align buffers at cacheline

This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>

# 5b84dd67 05-Mar-2012 Mike Frysinger <vapier@gentoo.org>

usb: replace wait_ms() with mdelay()

Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>

# 5dd95cf9 21-Dec-2011 Kyle Moffett <Kyle.D.Moffett@boeing.com>

usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

# 4b210e8b 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash subsequent warnings in usb_storage.c

usb_storage.c: In function ‘us_one_transfer’:
usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_reset’:
usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_comdat’:
usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_transport’:
usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_transport’:
usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Remy Bohmer <linux@bohmer.net>

# 86bd3ff8 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash warning in usb_storage.c

usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>

# f092f15d 04-Oct-2011 Wolfgang Denk <wd@denx.de>

Revert "GCC4.6: Convert various empty macros to inline functions"

This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac.

The commit causes build breakage for a number of boards. This results
from the fact that now the arguments of debug() actually get
referenced (even if there is hope that the compiler will optimize
away the debug() call). The obvious fix to that probem (change the
code to always declare the referenced variables and data structures)
increases the code size, and was this rejected. So it was decided to
revert this commit until a better solution is found.

# 60ce53cf 26-Sep-2011 Marek Vasut <marex@denx.de>

GCC4.6: Convert various empty macros to inline functions

Fix the following gcc4.6 problems:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]
asix.c: In function ‘asix_init’:
asix.c:317:6: warning: variable ‘rx_ctl’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_parse_config’:
usb.c:331:17: warning: variable ‘ch’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_port_connect_change’:
usb.c:1123:29: warning: variable ‘portchange’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_configure’:
usb.c:1183:25: warning: variable ‘hubsts’ set but not used
[-Wunused-but-set-variable]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>

# df3fc526 23-May-2011 Matthew McClintock <msm@freescale.com>

disk/part.c: Make features optional

If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>

# 6052cbab 03-Feb-2011 Loïc Minier <loic.minier@linaro.org>

Fix misc spelling errors found by lintian

Signed-off-by: Lo�c Minier <loic.minier@linaro.org>

# 56887e27 24-Mar-2011 Erik Hansen <erik@makarta.com>

Remove unnecessary reset in usb_stor_get_info

The reset request in usb_stor_get_info is causing issues with some usb
sticks. Some of these sticks vendor_id/product_id have been hardcoded to
not reset but better is to remove the reset altogether. It is not needed.

Signed-off-by: Erik Hansen <erik@makarta.com>

# 2ff12285 20-Oct-2010 Mike Frysinger <vapier@gentoo.org>

usb_storage: constify us_direction lookup table

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 99e9ed1f 05-Oct-2010 Ludovic Courtès <ludo@gnu.org>

usb: Add support for multiple-LUN mass storage devices

This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device. It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>

# 226fa9bb 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: change progress output in debug() message

The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
. <<==== here
29 file.001
29 file.002
29 file.003
29 file.004
29 file.005
29 file.006
29 file.007
29 file.008
29 file.009
29 file.010
29 file.011
29 file.012
29 file.013
29 file.014
29 file.015
29 file.016
. <<==== here
29 file.017
29 file.018
29 file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# a17c548b 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: initialize device type

The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

=> usb part
print_part of 0

Partition Map for USB device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 0 2031616 f8

print_part of 1
## Unknown partition table

print_part of 2
## Unknown partition table

print_part of 3
## Unknown partition table

print_part of 4
## Unknown partition table
=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# fac71cc4 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage probe

While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# aaad108b 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage count

Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# 127e1084 02-Nov-2009 Mahavir Jain <mjain@marvell.com>

usb: write command for RAW partition.

This patch implements write support to usb device with raw partition.
It will be useful for filesystem write support to usb device from
u-boot in future.

Tested with writing kernel image to raw usb disk & booting with usb
read command into ram.

[Note: run usb part to get info about start sector & number of
sectors on a partition for usb write operation.]

Signed-off-by: Mahavir Jain <mjain@marvell.com>

# 8f8bd565 30-Oct-2009 Tom Rix <Tom.Rix@windriver.com>

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

unsigned char bRefresh
unsigned char bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h. The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>

# 792a09eb 13-May-2009 Detlev Zundel <dzu@denx.de>

Fix e-mail address of Gary Jennejohn.

Signed-off-by: Detlev Zundel <dzu@denx.de>

# 9704f9ca 28-Oct-2008 Abraham, Thomas <t-abraham@ti.com>

USB: Remove LUN number from CDB

The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB.

Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# c7d703f3 01-Jan-2009 Mike Frysinger <vapier@gentoo.org>

usb.h: use standard __LITTLE_ENDIAN from Linux headers

Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# 14e4111c 01-Jan-2009 Bryan Wu <Bryan.Wu@analog.com>

usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb drive

The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4
does not like to be reset, so check for it.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# a0cb3fc3 10-Dec-2008 Michael Trimarchi <trimarchi@gandalf.sssup.it>

USB storage cleanup patch

Cleanup usb storage

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# d6e9ee92 12-Aug-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

common: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# d0ff51ba 14-Jul-2008 Wolfgang Denk <wd@denx.de>

Code cleanup: fix old style assignment ambiguities like "=-" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c918261c 21-May-2008 Christian Eggers <ceggers@gmx.de>

USB: replace old swap_ with proper endianess conversion macros

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 1aeed8d7 13-Apr-2008 Wolfgang Denk <wd@denx.de>

Coding Style cleanup; update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b9e749e9 26-Mar-2008 Markus Klotzbuecher <mk@denx.de>

USB, Storage: fix a bug introduced in commit
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info
to only print only information on one storage device, but not for
multiple.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# f6b44e0e 24-Mar-2008 Aras Vaichas <arasv@magtech.com.au>

USB Storage, add meaningful return value

This patch changes the "usb storage" command to return success if it
finds a USB storage device, otherwise it returns error.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 409ecdc0 18-Nov-2007 Wolfgang Denk <wd@denx.de>

Fix compiler warnings for PPC systems. Update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 90253178 10-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/: Remove lingering references to CFG_CMD_* symbols.

Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# c3517f91 08-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDS

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# b453960d 11-Jun-2007 Jon Loeliger <jdl@jdl.com>

common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).

This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# eb867a76 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers

Block device read/write is anonymous data; there is no need to use a
typed pointer. void * is fine. Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 735dd97b 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 1_4] Merge common get_dev() routines for block devices

Each of the filesystem drivers duplicate the get_dev routine. This change
merges them into a single function in part.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 73652699 19-Oct-2006 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# ddde6b7c 22-Aug-2006 Bartlomiej Sieka <tur@semihalf.com>

Add a fix for a buggy USB device on the FO300 board.

# f88a0ae6 13-Jul-2006 Bartlomiej Sieka <tur@semihalf.com>

Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.

# 77ddac94 13-Oct-2005 Wolfgang Denk <wd@denx.de>

Cleanup for GCC-4.x

# 460c322f 03-Aug-2005 Wolfgang Denk <wd@denx.de>

(re)enabled scsi commands do_scsi() and do_scsiboot()
Patch by Denis Peter, 06 Dec 2004

# 095b8a37 02-Aug-2005 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# 9c998aa8 21-Jul-2005 Wolfgang Denk <wd@denx.de>

Fix low-level OHCI transfers for ARM920t and MPC5xxx

A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.

# 2729af9d 03-May-2004 Wolfgang Denk <wd@denx.de>

* Fix minor NAND JFFS2 related issue

* Fixes for SL811 USB controller:
- implement workaround for broken memory stick
- improve error handling

* Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better
cope with congested networks.

# f8d813e3 02-Mar-2004 Wolfgang Denk <wd@denx.de>

* Fix SDRAM timings for LITE5200 / IceCube board

* Handle Auti-MDIX / connection status for INCA-IP

* Fix USB problems when attempting to read 0 bytes

# 80885a9d 26-Feb-2004 Wolfgang Denk <wd@denx.de>

* Patch by Markus Pietrek, 24 Feb 2004:
NS9750 DevBoard added

* Patch by Pierre AUBERT, 24 Feb 2004
add USB support for MPC5200

* Patch by Steven Scholz, 24 Feb 2004:
- fix MII commands to use values from last command

* Patch by Torsten Demke, 24 Feb 2004:
Add support for the eXalion platform (SPSW-8240, F-30, F-300)

# f54ebdfa 17-Sep-2003 Wolfgang Denk <wd@denx.de>

Add auto-update code for TRAB board using USB memory sticks

# a43278a4 11-Sep-2003 Wolfgang Denk <wd@denx.de>

* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices

* Patch by Denis Peter, 11 Sep 2003:
- fix USB data pointer assignment for bulk only transfer.
- prevent to display erased directories in FAT filesystem.

* Change output format for NAND flash - make it look like for other
memory, too

# 149dded2 10-Sep-2003 Wolfgang Denk <wd@denx.de>

* Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD

# 8bde7f77 27-Jun-2003 Wolfgang Denk <wd@denx.de>

* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)

# affae2bf 17-Aug-2002 Wolfgang Denk <wd@denx.de>

Initial revision

# d7d78576 30-Jul-2023 Simon Glass <sjg@chromium.org>

bootstd: Rename bootdev_setup_sibling_blk()

This name is a little confusing since it suggests that it sets up the
sibling block device. In fact it sets up a bootdev for it. Rename the
function to make this clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 04448899 04-Nov-2022 Janne Grunau <j@jannau.net>

usb: storage: continue probe on "Invalid device"

Fixes a crash during probing of sd card readers without medium present.
Seen with the device below but reported for many other devices.

idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x0326 Card reader
bcdDevice 11.24
iManufacturer 1 Realtek
iProduct 2 USB3.0 Card Reader
iSerial 3 201404081410

Link: https://github.com/AsahiLinux/linux/issues/44
Link: https://lists.denx.de/pipermail/u-boot/2022-July/489717.html

Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 8149b150 17-Sep-2022 Simon Glass <sjg@chromium.org>

blk: Rename if_type to uclass_id

Use the word 'uclass' instead of 'if_type' to complete the conversion.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ccb0ac5 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: usb: Add a bootdev driver

Add a bootdev driver for USB host. It can use the distro boot mechanism to
locate a file, or any other available bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8c9812a5 08-Mar-2022 AKASHI Takahiro <takahiro.akashi@linaro.org>

usb: storage: call device_probe() after scanning

Every time a usb bus/port is scanned and a new device is detected,
we want to call device_probe() as it will give us a chance to run
additional post-processings for some purposes.

In particular, support for creating partitions on a device will be added.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0cf207ec 27-Sep-2021 Wolfgang Denk <wd@denx.de>

WS cleanup: remove SPACE(s) followed by TAB

Signed-off-by: Wolfgang Denk <wd@denx.de>

# bc0b99bd 06-Jan-2021 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2021.04

arm64:
- DT updates

microblaze:
- Add support for NOR device support

spi:
- Fix unaligned data write issue

nand:
- Minor code change

xilinx:
- Fru fix in limit calculation
- Fill git repo link for all Xilinx boards

video:
- Add support for seps525 spi display

tools:
- Minor Vitis file support

cmd/common
- Minor code indentation fixes

serial:
- Uartlite debug uart initialization fix


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@amd.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31232de0 06-Apr-2020 Marek Vasut <marex@denx.de>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]

# da3d1c49 05-Oct-2019 Marek Vasut <marex@denx.de>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 7d6fd7f0 15-Sep-2019 Marek Vasut <marex@denx.de>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# d0851c89 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dee37fc9 06-Aug-2018 Masahiro Yamada <masahiroy@kernel.org>

Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

typedef unsigned int u32;
typedef unsigned long uintptr_t;
typedef unsigned long long u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly. You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 72ac8f3f 27-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# ea7fad91 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled

When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 6158d0b4 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Refactor to use max_xfer_blk from struct us_data

This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# b9560ad6 14-Jun-2017 Simon Glass <sjg@chromium.org>

dm: scsi: Drop the ccb typedef

We should not be using typedefs in U-Boot and 'ccb' is a pretty short
name. It is also used with variables. Drop the typedef and use 'struct'
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8850c5d5 12-May-2017 Tom Rini <trini@konsulko.com>

Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1e5eca7d 10-Apr-2017 Troy Kisky <troy.kisky@boundarydevices.com>

usb: return 0 from usb_stor_get_info even if removable media

This fixes a regression caused by

commit 07b2b78ce4bc8ae25e066c65245eaf58c0d9a67c
dm: usb: Convert USB storage to use driver-model for block devs

which caused part_init to be called when it was not previously.
Without this patch, the following happens when a USB sd card reader is used.

=> usb start
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1 for devices... 3 USB Device(s) found
scanning usb for storage devices... Device NOT ready
Request Sense returned 02 3A 00
### ERROR ### Please RESET the board ###

This happens because dev_desc->blksz is 0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

# b984700c 21-Dec-2016 Michal Simek <michal.simek@amd.com>

usb: storage: Show number of storage devices detected for DM_USB

By enabling DM_USB information about number of storage devices
was lost.
Get this information back simply by printing number of devices detected
via BLK uclass.

For example:
scanning bus 0 for devices... 7 USB Device(s) found
scanning usb for storage devices... 3 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 8319aeb1 06-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9107c973 01-May-2016 Simon Glass <sjg@chromium.org>

dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 57ebf67b 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0543bf6 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b94fc851 16-Mar-2016 Simon Glass <sjg@chromium.org>

usb: Correct return value in usb_stor_info()

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# a6f70a3d 15-Mar-2016 Vagrant Cascadian <vagrant@debian.org>

Fix spelling of "transferred".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 07b2b78c 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Convert USB storage to use driver-model for block devs

Update this code to support CONFIG_BLK. Each USB storage device can have
one or more block devices as children, each one representing a LUN
(logical unit) of the USB device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 9807c3b7 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Tidy up storage code ready for driver model conversion

Adjust a few things so that the addition of driver-models support involved
adding code rather than also changing it. This makes the patches easier to
review.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c89e79d4 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Avoid exceeding available array size for storage devices

The limit on storage devices is USB_MAX_STOR_DEV but we use one extra
element while probing to see if a device is a storage device. Avoid this,
since it causes memory corruption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# bcce53d0 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 3e8bd469 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: part: Rename some partition functions

Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4101f687 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: Drop the block_dev_desc_t typedef

Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4ef79099 07-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7c4213f6 07-Dec-2015 Stephen Warren <swarren@nvidia.com>

block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 70caa971 03-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Allow up to 7 storage devices

The current limit of 5 is not enough for the driver model USB tests. Really
we should not have a limit but the driver model code still uses the
usb_dev_desc[] array, which has a limit.

Increasing the limit by 2 should not bother anyone. Adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f5fb78a2 11-Oct-2015 Tom Rini <trini@konsulko.com>

common/usb_storage.c: Clean up usb_storage_probe()

We have the protocol and subclass variables which are used only in
disabled debug code. This code dates back to the initial git import and
seemingly dead code so remove it.

This was detected by Coverity (CID 131117)

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcbe3d15 28-Sep-2015 Simon Glass <sjg@chromium.org>

dm: Rename dev_get_parentdata() to dev_get_parent_priv()

The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

# cf92e05c 02-Sep-2015 Simon Glass <sjg@chromium.org>

Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header

Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# abb59cff 06-Jul-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust the USB_DEVICE() macro naming

In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
We should follow the same convention in U-Boot. Rename the existing
USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
macro from Linux for use in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>

# acf277af 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Convert usb_storage to driver model

Add support for scanning USB storage devices with driver model. This mostly
involves adding a USB device ID for storage devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 91557579 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move storage device scanning into its own function

The usb_stor_scan() function is quite long, so split out the code that scans
each device into its own function. Also, rather than setting up the block
device list once at the start, set it up as each device is scanned. This
makes it possible to use this code from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7fc2c1ea 16-Apr-2015 Simon Glass <sjg@chromium.org>

Revert "usb_storage : scan all interfaces to find a storage device"

This reverts commit cd749658d5994978579628a6333e5c2a6c8ec632.

The conflicts with this commit are hard for me to figure out. I will re-apply
it later.

# 05108132 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust usb_storage to work with sandbox

With a few tweaks we can compile this code with sandbox and enable testing
of the USB storage layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 84073b6f 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Simply device finding code in usb_storage

The for() loop is not needed since the value is immediately accessible.
Use this instead to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1d5827a1 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2e17c87e 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move USB storage definitions to usb_defs.h

These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f6570871 01-Apr-2015 Sergey Temerkhanov <s.temerkhanov@gmail.com>

usb_storage:Fix USB storage capacity detection on 64 bit architectures

This patch fixes USB storage capacity detection breakage on 64-bit systems
which arises due to 'unsigned long' length difference. Old code assumes that
to be 32 bit and breaks because of inappropriate response buffer layout.
Also this fixes a number of build warnings and changes big-endian values
treatment style to be architecture-independent

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>

# cd749658 04-Mar-2015 Franck Jullien <franck.jullien@gmail.com>

usb_storage : scan all interfaces to find a storage device

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>

# 6a559bbe 07-Nov-2014 Soeren Moch <smoch@web.de>

usb_storage: blacklist Enclosure Service Devices

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>

# 4fd074de 15-Oct-2014 Simon Glass <sjg@chromium.org>

usb: Use correct printf() format string for uintptr_t

Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ff8fef56 14-Jun-2013 Sascha Silbe <t-uboot@infra-silbe.de>

Fix block device accesses beyond 2TiB

With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>

# 605bd75a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

USB: Some cleanup prior to USB 3.0 interface addition

Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# ceb4972a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

usb: common: Weed out USB_**_PRINTFs from usb framework

USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# 0472fbfd 09-Apr-2013 Egbert Eich <eich@suse.com>

part/dev_desc: Add log2 of blocksize to block_dev_desc data struct

log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>

# 8b57e2f0 12-Dec-2012 Vincent Palatin <vpalatin@chromium.org>

usb: properly detect empty mass storage media reader

When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 199adb60 29-Oct-2012 Kim Phillips <kim.phillips@freescale.com>

common/misc: sparse fixes

command.c:44:38: error: bad constant expression
dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
hush.c:2175:20: warning: Using plain integer as NULL pointer
hush.c:2175:34: warning: Using plain integer as NULL pointer
hush.c:2210:41: warning: Using plain integer as NULL pointer
hush.c:2216:45: warning: Using plain integer as NULL pointer
hush.c:2249:25: warning: Using plain integer as NULL pointer
hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
hush.c:3295:34: warning: Using plain integer as NULL pointer
hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
image.c:1282:29: warning: Using plain integer as NULL pointer
image.c:1315:41: warning: Using plain integer as NULL pointer
image.c:1330:25: warning: Using plain integer as NULL pointer
image.c:1706:25: warning: Using plain integer as NULL pointer
main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
usb_storage.c:440:48: warning: Using plain integer as NULL pointer
usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
usb_storage.c:629:55: warning: Using plain integer as NULL pointer
usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
usb_storage.c:675:43: warning: Using plain integer as NULL pointer
usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

note: hush.c's nesting_level deleted because not used.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# e81e79ed 12-Oct-2012 Gabe Black <gabeblack@chromium.org>

usb: Support the CONFIG_SYS_64BIT_LBA option

usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 93c2582f 25-Sep-2012 Lucas Stach <dev@lynxeye.de>

usb: add support for multiple usb controllers

Allows to initialize more than one USB controller at once.

v2: print message when controller stop fails

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>

# b7006958 30-Jul-2012 Jim Shimer <jamesshimer@motorola.com>

usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

# 3e8581bb 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
- Rebase against the latest u-boot-usb master.
- Replace typedef with #define.
- Use the existing flags struct field instead of adding a new field.
- Remove the setter function.
- Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>

# 4bee5c83 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# cffcc503 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# 1b4bd0e6 09-Jul-2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

usb_storage: fix ehci driver max transfer size

The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage:
Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in
usb_storage as it wrongly assumes that every transfer can use
4096 bytes per qt_buffer. This is wrong if the start address of
the data is not page aligned to 4096 bytes and leads to 'EHCI
timed out on TD' messages because of 'out of buffer pointers'
in ehci_td_buffer function.

The bug appears during load of a fragmented file and
read from or write to an unaligned memory address.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# f5766139 03-Apr-2012 Puneet Saxena <puneets@nvidia.com>

USB: Align buffers at cacheline

This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>

# 5b84dd67 05-Mar-2012 Mike Frysinger <vapier@gentoo.org>

usb: replace wait_ms() with mdelay()

Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>

# 5dd95cf9 21-Dec-2011 Kyle Moffett <Kyle.D.Moffett@boeing.com>

usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

# 4b210e8b 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash subsequent warnings in usb_storage.c

usb_storage.c: In function ‘us_one_transfer’:
usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_reset’:
usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_comdat’:
usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_transport’:
usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_transport’:
usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Remy Bohmer <linux@bohmer.net>

# 86bd3ff8 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash warning in usb_storage.c

usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>

# f092f15d 04-Oct-2011 Wolfgang Denk <wd@denx.de>

Revert "GCC4.6: Convert various empty macros to inline functions"

This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac.

The commit causes build breakage for a number of boards. This results
from the fact that now the arguments of debug() actually get
referenced (even if there is hope that the compiler will optimize
away the debug() call). The obvious fix to that probem (change the
code to always declare the referenced variables and data structures)
increases the code size, and was this rejected. So it was decided to
revert this commit until a better solution is found.

# 60ce53cf 26-Sep-2011 Marek Vasut <marex@denx.de>

GCC4.6: Convert various empty macros to inline functions

Fix the following gcc4.6 problems:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]
asix.c: In function ‘asix_init’:
asix.c:317:6: warning: variable ‘rx_ctl’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_parse_config’:
usb.c:331:17: warning: variable ‘ch’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_port_connect_change’:
usb.c:1123:29: warning: variable ‘portchange’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_configure’:
usb.c:1183:25: warning: variable ‘hubsts’ set but not used
[-Wunused-but-set-variable]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>

# df3fc526 23-May-2011 Matthew McClintock <msm@freescale.com>

disk/part.c: Make features optional

If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>

# 6052cbab 03-Feb-2011 Loïc Minier <loic.minier@linaro.org>

Fix misc spelling errors found by lintian

Signed-off-by: Lo�c Minier <loic.minier@linaro.org>

# 56887e27 24-Mar-2011 Erik Hansen <erik@makarta.com>

Remove unnecessary reset in usb_stor_get_info

The reset request in usb_stor_get_info is causing issues with some usb
sticks. Some of these sticks vendor_id/product_id have been hardcoded to
not reset but better is to remove the reset altogether. It is not needed.

Signed-off-by: Erik Hansen <erik@makarta.com>

# 2ff12285 20-Oct-2010 Mike Frysinger <vapier@gentoo.org>

usb_storage: constify us_direction lookup table

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 99e9ed1f 05-Oct-2010 Ludovic Courtès <ludo@gnu.org>

usb: Add support for multiple-LUN mass storage devices

This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device. It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>

# 226fa9bb 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: change progress output in debug() message

The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
. <<==== here
29 file.001
29 file.002
29 file.003
29 file.004
29 file.005
29 file.006
29 file.007
29 file.008
29 file.009
29 file.010
29 file.011
29 file.012
29 file.013
29 file.014
29 file.015
29 file.016
. <<==== here
29 file.017
29 file.018
29 file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# a17c548b 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: initialize device type

The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

=> usb part
print_part of 0

Partition Map for USB device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 0 2031616 f8

print_part of 1
## Unknown partition table

print_part of 2
## Unknown partition table

print_part of 3
## Unknown partition table

print_part of 4
## Unknown partition table
=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# fac71cc4 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage probe

While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# aaad108b 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage count

Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# 127e1084 02-Nov-2009 Mahavir Jain <mjain@marvell.com>

usb: write command for RAW partition.

This patch implements write support to usb device with raw partition.
It will be useful for filesystem write support to usb device from
u-boot in future.

Tested with writing kernel image to raw usb disk & booting with usb
read command into ram.

[Note: run usb part to get info about start sector & number of
sectors on a partition for usb write operation.]

Signed-off-by: Mahavir Jain <mjain@marvell.com>

# 8f8bd565 30-Oct-2009 Tom Rix <Tom.Rix@windriver.com>

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

unsigned char bRefresh
unsigned char bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h. The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>

# 792a09eb 13-May-2009 Detlev Zundel <dzu@denx.de>

Fix e-mail address of Gary Jennejohn.

Signed-off-by: Detlev Zundel <dzu@denx.de>

# 9704f9ca 28-Oct-2008 Abraham, Thomas <t-abraham@ti.com>

USB: Remove LUN number from CDB

The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB.

Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# c7d703f3 01-Jan-2009 Mike Frysinger <vapier@gentoo.org>

usb.h: use standard __LITTLE_ENDIAN from Linux headers

Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# 14e4111c 01-Jan-2009 Bryan Wu <Bryan.Wu@analog.com>

usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb drive

The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4
does not like to be reset, so check for it.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# a0cb3fc3 10-Dec-2008 Michael Trimarchi <trimarchi@gandalf.sssup.it>

USB storage cleanup patch

Cleanup usb storage

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# d6e9ee92 12-Aug-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

common: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# d0ff51ba 14-Jul-2008 Wolfgang Denk <wd@denx.de>

Code cleanup: fix old style assignment ambiguities like "=-" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c918261c 21-May-2008 Christian Eggers <ceggers@gmx.de>

USB: replace old swap_ with proper endianess conversion macros

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 1aeed8d7 13-Apr-2008 Wolfgang Denk <wd@denx.de>

Coding Style cleanup; update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b9e749e9 26-Mar-2008 Markus Klotzbuecher <mk@denx.de>

USB, Storage: fix a bug introduced in commit
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info
to only print only information on one storage device, but not for
multiple.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# f6b44e0e 24-Mar-2008 Aras Vaichas <arasv@magtech.com.au>

USB Storage, add meaningful return value

This patch changes the "usb storage" command to return success if it
finds a USB storage device, otherwise it returns error.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 409ecdc0 18-Nov-2007 Wolfgang Denk <wd@denx.de>

Fix compiler warnings for PPC systems. Update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 90253178 10-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/: Remove lingering references to CFG_CMD_* symbols.

Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# c3517f91 08-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDS

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# b453960d 11-Jun-2007 Jon Loeliger <jdl@jdl.com>

common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).

This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# eb867a76 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers

Block device read/write is anonymous data; there is no need to use a
typed pointer. void * is fine. Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 735dd97b 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 1_4] Merge common get_dev() routines for block devices

Each of the filesystem drivers duplicate the get_dev routine. This change
merges them into a single function in part.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 73652699 19-Oct-2006 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# ddde6b7c 22-Aug-2006 Bartlomiej Sieka <tur@semihalf.com>

Add a fix for a buggy USB device on the FO300 board.

# f88a0ae6 13-Jul-2006 Bartlomiej Sieka <tur@semihalf.com>

Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.

# 77ddac94 13-Oct-2005 Wolfgang Denk <wd@denx.de>

Cleanup for GCC-4.x

# 460c322f 03-Aug-2005 Wolfgang Denk <wd@denx.de>

(re)enabled scsi commands do_scsi() and do_scsiboot()
Patch by Denis Peter, 06 Dec 2004

# 095b8a37 02-Aug-2005 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# 9c998aa8 21-Jul-2005 Wolfgang Denk <wd@denx.de>

Fix low-level OHCI transfers for ARM920t and MPC5xxx

A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.

# 2729af9d 03-May-2004 Wolfgang Denk <wd@denx.de>

* Fix minor NAND JFFS2 related issue

* Fixes for SL811 USB controller:
- implement workaround for broken memory stick
- improve error handling

* Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better
cope with congested networks.

# f8d813e3 02-Mar-2004 Wolfgang Denk <wd@denx.de>

* Fix SDRAM timings for LITE5200 / IceCube board

* Handle Auti-MDIX / connection status for INCA-IP

* Fix USB problems when attempting to read 0 bytes

# 80885a9d 26-Feb-2004 Wolfgang Denk <wd@denx.de>

* Patch by Markus Pietrek, 24 Feb 2004:
NS9750 DevBoard added

* Patch by Pierre AUBERT, 24 Feb 2004
add USB support for MPC5200

* Patch by Steven Scholz, 24 Feb 2004:
- fix MII commands to use values from last command

* Patch by Torsten Demke, 24 Feb 2004:
Add support for the eXalion platform (SPSW-8240, F-30, F-300)

# f54ebdfa 17-Sep-2003 Wolfgang Denk <wd@denx.de>

Add auto-update code for TRAB board using USB memory sticks

# a43278a4 11-Sep-2003 Wolfgang Denk <wd@denx.de>

* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices

* Patch by Denis Peter, 11 Sep 2003:
- fix USB data pointer assignment for bulk only transfer.
- prevent to display erased directories in FAT filesystem.

* Change output format for NAND flash - make it look like for other
memory, too

# 149dded2 10-Sep-2003 Wolfgang Denk <wd@denx.de>

* Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD

# 8bde7f77 27-Jun-2003 Wolfgang Denk <wd@denx.de>

* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)

# affae2bf 17-Aug-2002 Wolfgang Denk <wd@denx.de>

Initial revision

# 04448899 04-Nov-2022 Janne Grunau <j@jannau.net>

usb: storage: continue probe on "Invalid device"

Fixes a crash during probing of sd card readers without medium present.
Seen with the device below but reported for many other devices.

idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x0326 Card reader
bcdDevice 11.24
iManufacturer 1 Realtek
iProduct 2 USB3.0 Card Reader
iSerial 3 201404081410

Link: https://github.com/AsahiLinux/linux/issues/44
Link: https://lists.denx.de/pipermail/u-boot/2022-July/489717.html

Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 8149b150 17-Sep-2022 Simon Glass <sjg@chromium.org>

blk: Rename if_type to uclass_id

Use the word 'uclass' instead of 'if_type' to complete the conversion.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ccb0ac5 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: usb: Add a bootdev driver

Add a bootdev driver for USB host. It can use the distro boot mechanism to
locate a file, or any other available bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8c9812a5 08-Mar-2022 AKASHI Takahiro <takahiro.akashi@linaro.org>

usb: storage: call device_probe() after scanning

Every time a usb bus/port is scanned and a new device is detected,
we want to call device_probe() as it will give us a chance to run
additional post-processings for some purposes.

In particular, support for creating partitions on a device will be added.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0cf207ec 27-Sep-2021 Wolfgang Denk <wd@denx.de>

WS cleanup: remove SPACE(s) followed by TAB

Signed-off-by: Wolfgang Denk <wd@denx.de>

# bc0b99bd 06-Jan-2021 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2021.04

arm64:
- DT updates

microblaze:
- Add support for NOR device support

spi:
- Fix unaligned data write issue

nand:
- Minor code change

xilinx:
- Fru fix in limit calculation
- Fill git repo link for all Xilinx boards

video:
- Add support for seps525 spi display

tools:
- Minor Vitis file support

cmd/common
- Minor code indentation fixes

serial:
- Uartlite debug uart initialization fix


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@amd.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31232de0 06-Apr-2020 Marek Vasut <marex@denx.de>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]

# da3d1c49 05-Oct-2019 Marek Vasut <marex@denx.de>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 7d6fd7f0 15-Sep-2019 Marek Vasut <marex@denx.de>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# d0851c89 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dee37fc9 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

typedef unsigned int u32;
typedef unsigned long uintptr_t;
typedef unsigned long long u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly. You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 72ac8f3f 27-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# ea7fad91 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled

When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 6158d0b4 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Refactor to use max_xfer_blk from struct us_data

This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# b9560ad6 14-Jun-2017 Simon Glass <sjg@chromium.org>

dm: scsi: Drop the ccb typedef

We should not be using typedefs in U-Boot and 'ccb' is a pretty short
name. It is also used with variables. Drop the typedef and use 'struct'
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8850c5d5 12-May-2017 Tom Rini <trini@konsulko.com>

Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1e5eca7d 10-Apr-2017 Troy Kisky <troy.kisky@boundarydevices.com>

usb: return 0 from usb_stor_get_info even if removable media

This fixes a regression caused by

commit 07b2b78ce4bc8ae25e066c65245eaf58c0d9a67c
dm: usb: Convert USB storage to use driver-model for block devs

which caused part_init to be called when it was not previously.
Without this patch, the following happens when a USB sd card reader is used.

=> usb start
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1 for devices... 3 USB Device(s) found
scanning usb for storage devices... Device NOT ready
Request Sense returned 02 3A 00
### ERROR ### Please RESET the board ###

This happens because dev_desc->blksz is 0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

# b984700c 21-Dec-2016 Michal Simek <michal.simek@amd.com>

usb: storage: Show number of storage devices detected for DM_USB

By enabling DM_USB information about number of storage devices
was lost.
Get this information back simply by printing number of devices detected
via BLK uclass.

For example:
scanning bus 0 for devices... 7 USB Device(s) found
scanning usb for storage devices... 3 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 8319aeb1 06-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9107c973 01-May-2016 Simon Glass <sjg@chromium.org>

dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 57ebf67b 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0543bf6 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b94fc851 16-Mar-2016 Simon Glass <sjg@chromium.org>

usb: Correct return value in usb_stor_info()

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# a6f70a3d 15-Mar-2016 Vagrant Cascadian <vagrant@debian.org>

Fix spelling of "transferred".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 07b2b78c 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Convert USB storage to use driver-model for block devs

Update this code to support CONFIG_BLK. Each USB storage device can have
one or more block devices as children, each one representing a LUN
(logical unit) of the USB device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 9807c3b7 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Tidy up storage code ready for driver model conversion

Adjust a few things so that the addition of driver-models support involved
adding code rather than also changing it. This makes the patches easier to
review.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c89e79d4 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Avoid exceeding available array size for storage devices

The limit on storage devices is USB_MAX_STOR_DEV but we use one extra
element while probing to see if a device is a storage device. Avoid this,
since it causes memory corruption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# bcce53d0 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 3e8bd469 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: part: Rename some partition functions

Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4101f687 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: Drop the block_dev_desc_t typedef

Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4ef79099 07-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7c4213f6 07-Dec-2015 Stephen Warren <swarren@nvidia.com>

block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 70caa971 03-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Allow up to 7 storage devices

The current limit of 5 is not enough for the driver model USB tests. Really
we should not have a limit but the driver model code still uses the
usb_dev_desc[] array, which has a limit.

Increasing the limit by 2 should not bother anyone. Adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f5fb78a2 11-Oct-2015 Tom Rini <trini@konsulko.com>

common/usb_storage.c: Clean up usb_storage_probe()

We have the protocol and subclass variables which are used only in
disabled debug code. This code dates back to the initial git import and
seemingly dead code so remove it.

This was detected by Coverity (CID 131117)

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcbe3d15 28-Sep-2015 Simon Glass <sjg@chromium.org>

dm: Rename dev_get_parentdata() to dev_get_parent_priv()

The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

# cf92e05c 02-Sep-2015 Simon Glass <sjg@chromium.org>

Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header

Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# abb59cff 06-Jul-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust the USB_DEVICE() macro naming

In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
We should follow the same convention in U-Boot. Rename the existing
USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
macro from Linux for use in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>

# acf277af 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Convert usb_storage to driver model

Add support for scanning USB storage devices with driver model. This mostly
involves adding a USB device ID for storage devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 91557579 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move storage device scanning into its own function

The usb_stor_scan() function is quite long, so split out the code that scans
each device into its own function. Also, rather than setting up the block
device list once at the start, set it up as each device is scanned. This
makes it possible to use this code from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7fc2c1ea 16-Apr-2015 Simon Glass <sjg@chromium.org>

Revert "usb_storage : scan all interfaces to find a storage device"

This reverts commit cd749658d5994978579628a6333e5c2a6c8ec632.

The conflicts with this commit are hard for me to figure out. I will re-apply
it later.

# 05108132 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust usb_storage to work with sandbox

With a few tweaks we can compile this code with sandbox and enable testing
of the USB storage layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 84073b6f 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Simply device finding code in usb_storage

The for() loop is not needed since the value is immediately accessible.
Use this instead to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1d5827a1 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2e17c87e 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move USB storage definitions to usb_defs.h

These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f6570871 01-Apr-2015 Sergey Temerkhanov <s.temerkhanov@gmail.com>

usb_storage:Fix USB storage capacity detection on 64 bit architectures

This patch fixes USB storage capacity detection breakage on 64-bit systems
which arises due to 'unsigned long' length difference. Old code assumes that
to be 32 bit and breaks because of inappropriate response buffer layout.
Also this fixes a number of build warnings and changes big-endian values
treatment style to be architecture-independent

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>

# cd749658 04-Mar-2015 Franck Jullien <franck.jullien@gmail.com>

usb_storage : scan all interfaces to find a storage device

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>

# 6a559bbe 07-Nov-2014 Soeren Moch <smoch@web.de>

usb_storage: blacklist Enclosure Service Devices

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>

# 4fd074de 15-Oct-2014 Simon Glass <sjg@chromium.org>

usb: Use correct printf() format string for uintptr_t

Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ff8fef56 14-Jun-2013 Sascha Silbe <t-uboot@infra-silbe.de>

Fix block device accesses beyond 2TiB

With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>

# 605bd75a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

USB: Some cleanup prior to USB 3.0 interface addition

Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# ceb4972a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

usb: common: Weed out USB_**_PRINTFs from usb framework

USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# 0472fbfd 09-Apr-2013 Egbert Eich <eich@suse.com>

part/dev_desc: Add log2 of blocksize to block_dev_desc data struct

log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>

# 8b57e2f0 12-Dec-2012 Vincent Palatin <vpalatin@chromium.org>

usb: properly detect empty mass storage media reader

When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 199adb60 29-Oct-2012 Kim Phillips <kim.phillips@freescale.com>

common/misc: sparse fixes

command.c:44:38: error: bad constant expression
dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
hush.c:2175:20: warning: Using plain integer as NULL pointer
hush.c:2175:34: warning: Using plain integer as NULL pointer
hush.c:2210:41: warning: Using plain integer as NULL pointer
hush.c:2216:45: warning: Using plain integer as NULL pointer
hush.c:2249:25: warning: Using plain integer as NULL pointer
hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
hush.c:3295:34: warning: Using plain integer as NULL pointer
hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
image.c:1282:29: warning: Using plain integer as NULL pointer
image.c:1315:41: warning: Using plain integer as NULL pointer
image.c:1330:25: warning: Using plain integer as NULL pointer
image.c:1706:25: warning: Using plain integer as NULL pointer
main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
usb_storage.c:440:48: warning: Using plain integer as NULL pointer
usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
usb_storage.c:629:55: warning: Using plain integer as NULL pointer
usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
usb_storage.c:675:43: warning: Using plain integer as NULL pointer
usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

note: hush.c's nesting_level deleted because not used.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# e81e79ed 12-Oct-2012 Gabe Black <gabeblack@chromium.org>

usb: Support the CONFIG_SYS_64BIT_LBA option

usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 93c2582f 25-Sep-2012 Lucas Stach <dev@lynxeye.de>

usb: add support for multiple usb controllers

Allows to initialize more than one USB controller at once.

v2: print message when controller stop fails

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>

# b7006958 30-Jul-2012 Jim Shimer <jamesshimer@motorola.com>

usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

# 3e8581bb 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
- Rebase against the latest u-boot-usb master.
- Replace typedef with #define.
- Use the existing flags struct field instead of adding a new field.
- Remove the setter function.
- Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>

# 4bee5c83 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# cffcc503 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# 1b4bd0e6 09-Jul-2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

usb_storage: fix ehci driver max transfer size

The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage:
Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in
usb_storage as it wrongly assumes that every transfer can use
4096 bytes per qt_buffer. This is wrong if the start address of
the data is not page aligned to 4096 bytes and leads to 'EHCI
timed out on TD' messages because of 'out of buffer pointers'
in ehci_td_buffer function.

The bug appears during load of a fragmented file and
read from or write to an unaligned memory address.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# f5766139 03-Apr-2012 Puneet Saxena <puneets@nvidia.com>

USB: Align buffers at cacheline

This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>

# 5b84dd67 05-Mar-2012 Mike Frysinger <vapier@gentoo.org>

usb: replace wait_ms() with mdelay()

Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>

# 5dd95cf9 21-Dec-2011 Kyle Moffett <Kyle.D.Moffett@boeing.com>

usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

# 4b210e8b 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash subsequent warnings in usb_storage.c

usb_storage.c: In function ‘us_one_transfer’:
usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_reset’:
usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_comdat’:
usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_transport’:
usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_transport’:
usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Remy Bohmer <linux@bohmer.net>

# 86bd3ff8 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash warning in usb_storage.c

usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>

# f092f15d 04-Oct-2011 Wolfgang Denk <wd@denx.de>

Revert "GCC4.6: Convert various empty macros to inline functions"

This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac.

The commit causes build breakage for a number of boards. This results
from the fact that now the arguments of debug() actually get
referenced (even if there is hope that the compiler will optimize
away the debug() call). The obvious fix to that probem (change the
code to always declare the referenced variables and data structures)
increases the code size, and was this rejected. So it was decided to
revert this commit until a better solution is found.

# 60ce53cf 26-Sep-2011 Marek Vasut <marex@denx.de>

GCC4.6: Convert various empty macros to inline functions

Fix the following gcc4.6 problems:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]
asix.c: In function ‘asix_init’:
asix.c:317:6: warning: variable ‘rx_ctl’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_parse_config’:
usb.c:331:17: warning: variable ‘ch’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_port_connect_change’:
usb.c:1123:29: warning: variable ‘portchange’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_configure’:
usb.c:1183:25: warning: variable ‘hubsts’ set but not used
[-Wunused-but-set-variable]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>

# df3fc526 23-May-2011 Matthew McClintock <msm@freescale.com>

disk/part.c: Make features optional

If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>

# 6052cbab 03-Feb-2011 Loïc Minier <loic.minier@linaro.org>

Fix misc spelling errors found by lintian

Signed-off-by: Lo�c Minier <loic.minier@linaro.org>

# 56887e27 24-Mar-2011 Erik Hansen <erik@makarta.com>

Remove unnecessary reset in usb_stor_get_info

The reset request in usb_stor_get_info is causing issues with some usb
sticks. Some of these sticks vendor_id/product_id have been hardcoded to
not reset but better is to remove the reset altogether. It is not needed.

Signed-off-by: Erik Hansen <erik@makarta.com>

# 2ff12285 20-Oct-2010 Mike Frysinger <vapier@gentoo.org>

usb_storage: constify us_direction lookup table

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 99e9ed1f 05-Oct-2010 Ludovic Courtès <ludo@gnu.org>

usb: Add support for multiple-LUN mass storage devices

This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device. It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>

# 226fa9bb 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: change progress output in debug() message

The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
. <<==== here
29 file.001
29 file.002
29 file.003
29 file.004
29 file.005
29 file.006
29 file.007
29 file.008
29 file.009
29 file.010
29 file.011
29 file.012
29 file.013
29 file.014
29 file.015
29 file.016
. <<==== here
29 file.017
29 file.018
29 file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# a17c548b 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: initialize device type

The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

=> usb part
print_part of 0

Partition Map for USB device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 0 2031616 f8

print_part of 1
## Unknown partition table

print_part of 2
## Unknown partition table

print_part of 3
## Unknown partition table

print_part of 4
## Unknown partition table
=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# fac71cc4 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage probe

While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# aaad108b 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage count

Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# 127e1084 02-Nov-2009 Mahavir Jain <mjain@marvell.com>

usb: write command for RAW partition.

This patch implements write support to usb device with raw partition.
It will be useful for filesystem write support to usb device from
u-boot in future.

Tested with writing kernel image to raw usb disk & booting with usb
read command into ram.

[Note: run usb part to get info about start sector & number of
sectors on a partition for usb write operation.]

Signed-off-by: Mahavir Jain <mjain@marvell.com>

# 8f8bd565 30-Oct-2009 Tom Rix <Tom.Rix@windriver.com>

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

unsigned char bRefresh
unsigned char bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h. The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>

# 792a09eb 13-May-2009 Detlev Zundel <dzu@denx.de>

Fix e-mail address of Gary Jennejohn.

Signed-off-by: Detlev Zundel <dzu@denx.de>

# 9704f9ca 28-Oct-2008 Abraham, Thomas <t-abraham@ti.com>

USB: Remove LUN number from CDB

The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB.

Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# c7d703f3 01-Jan-2009 Mike Frysinger <vapier@gentoo.org>

usb.h: use standard __LITTLE_ENDIAN from Linux headers

Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# 14e4111c 01-Jan-2009 Bryan Wu <Bryan.Wu@analog.com>

usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb drive

The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4
does not like to be reset, so check for it.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# a0cb3fc3 10-Dec-2008 Michael Trimarchi <trimarchi@gandalf.sssup.it>

USB storage cleanup patch

Cleanup usb storage

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# d6e9ee92 12-Aug-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

common: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# d0ff51ba 14-Jul-2008 Wolfgang Denk <wd@denx.de>

Code cleanup: fix old style assignment ambiguities like "=-" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c918261c 21-May-2008 Christian Eggers <ceggers@gmx.de>

USB: replace old swap_ with proper endianess conversion macros

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 1aeed8d7 13-Apr-2008 Wolfgang Denk <wd@denx.de>

Coding Style cleanup; update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b9e749e9 26-Mar-2008 Markus Klotzbuecher <mk@denx.de>

USB, Storage: fix a bug introduced in commit
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info
to only print only information on one storage device, but not for
multiple.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# f6b44e0e 24-Mar-2008 Aras Vaichas <arasv@magtech.com.au>

USB Storage, add meaningful return value

This patch changes the "usb storage" command to return success if it
finds a USB storage device, otherwise it returns error.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 409ecdc0 18-Nov-2007 Wolfgang Denk <wd@denx.de>

Fix compiler warnings for PPC systems. Update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 90253178 10-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/: Remove lingering references to CFG_CMD_* symbols.

Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# c3517f91 08-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDS

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# b453960d 11-Jun-2007 Jon Loeliger <jdl@jdl.com>

common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).

This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# eb867a76 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers

Block device read/write is anonymous data; there is no need to use a
typed pointer. void * is fine. Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 735dd97b 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 1_4] Merge common get_dev() routines for block devices

Each of the filesystem drivers duplicate the get_dev routine. This change
merges them into a single function in part.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 73652699 19-Oct-2006 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# ddde6b7c 22-Aug-2006 Bartlomiej Sieka <tur@semihalf.com>

Add a fix for a buggy USB device on the FO300 board.

# f88a0ae6 13-Jul-2006 Bartlomiej Sieka <tur@semihalf.com>

Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.

# 77ddac94 13-Oct-2005 Wolfgang Denk <wd@denx.de>

Cleanup for GCC-4.x

# 460c322f 03-Aug-2005 Wolfgang Denk <wd@denx.de>

(re)enabled scsi commands do_scsi() and do_scsiboot()
Patch by Denis Peter, 06 Dec 2004

# 095b8a37 02-Aug-2005 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# 9c998aa8 21-Jul-2005 Wolfgang Denk <wd@denx.de>

Fix low-level OHCI transfers for ARM920t and MPC5xxx

A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.

# 2729af9d 03-May-2004 Wolfgang Denk <wd@denx.de>

* Fix minor NAND JFFS2 related issue

* Fixes for SL811 USB controller:
- implement workaround for broken memory stick
- improve error handling

* Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better
cope with congested networks.

# f8d813e3 02-Mar-2004 Wolfgang Denk <wd@denx.de>

* Fix SDRAM timings for LITE5200 / IceCube board

* Handle Auti-MDIX / connection status for INCA-IP

* Fix USB problems when attempting to read 0 bytes

# 80885a9d 26-Feb-2004 Wolfgang Denk <wd@denx.de>

* Patch by Markus Pietrek, 24 Feb 2004:
NS9750 DevBoard added

* Patch by Pierre AUBERT, 24 Feb 2004
add USB support for MPC5200

* Patch by Steven Scholz, 24 Feb 2004:
- fix MII commands to use values from last command

* Patch by Torsten Demke, 24 Feb 2004:
Add support for the eXalion platform (SPSW-8240, F-30, F-300)

# f54ebdfa 17-Sep-2003 Wolfgang Denk <wd@denx.de>

Add auto-update code for TRAB board using USB memory sticks

# a43278a4 11-Sep-2003 Wolfgang Denk <wd@denx.de>

* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices

* Patch by Denis Peter, 11 Sep 2003:
- fix USB data pointer assignment for bulk only transfer.
- prevent to display erased directories in FAT filesystem.

* Change output format for NAND flash - make it look like for other
memory, too

# 149dded2 10-Sep-2003 Wolfgang Denk <wd@denx.de>

* Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD

# 8bde7f77 27-Jun-2003 Wolfgang Denk <wd@denx.de>

* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)

# affae2bf 17-Aug-2002 Wolfgang Denk <wd@denx.de>

Initial revision

# 8149b150 17-Sep-2022 Simon Glass <sjg@chromium.org>

blk: Rename if_type to uclass_id

Use the word 'uclass' instead of 'if_type' to complete the conversion.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e33a5c6b 11-Aug-2022 Simon Glass <sjg@chromium.org>

blk: Switch over to using uclass IDs

We currently have an if_type (interface type) and a uclass id. These are
closely related and we don't need to have both.

Drop the if_type values and use the uclass ones instead.

Maintain the existing, subtle, one-way conversion between UCLASS_USB and
UCLASS_MASS_STORAGE for now, and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ccb0ac5 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: usb: Add a bootdev driver

Add a bootdev driver for USB host. It can use the distro boot mechanism to
locate a file, or any other available bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8c9812a5 08-Mar-2022 AKASHI Takahiro <takahiro.akashi@linaro.org>

usb: storage: call device_probe() after scanning

Every time a usb bus/port is scanned and a new device is detected,
we want to call device_probe() as it will give us a chance to run
additional post-processings for some purposes.

In particular, support for creating partitions on a device will be added.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0cf207ec 27-Sep-2021 Wolfgang Denk <wd@denx.de>

WS cleanup: remove SPACE(s) followed by TAB

Signed-off-by: Wolfgang Denk <wd@denx.de>

# bc0b99bd 06-Jan-2021 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2021.04

arm64:
- DT updates

microblaze:
- Add support for NOR device support

spi:
- Fix unaligned data write issue

nand:
- Minor code change

xilinx:
- Fru fix in limit calculation
- Fill git repo link for all Xilinx boards

video:
- Add support for seps525 spi display

tools:
- Minor Vitis file support

cmd/common
- Minor code indentation fixes

serial:
- Uartlite debug uart initialization fix


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@amd.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31232de0 06-Apr-2020 Marek Vasut <marex@denx.de>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]

# da3d1c49 05-Oct-2019 Marek Vasut <marex@denx.de>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 7d6fd7f0 15-Sep-2019 Marek Vasut <marex@denx.de>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# d0851c89 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dee37fc9 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

typedef unsigned int u32;
typedef unsigned long uintptr_t;
typedef unsigned long long u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly. You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 72ac8f3f 27-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# ea7fad91 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled

When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 6158d0b4 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Refactor to use max_xfer_blk from struct us_data

This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# b9560ad6 14-Jun-2017 Simon Glass <sjg@chromium.org>

dm: scsi: Drop the ccb typedef

We should not be using typedefs in U-Boot and 'ccb' is a pretty short
name. It is also used with variables. Drop the typedef and use 'struct'
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8850c5d5 12-May-2017 Tom Rini <trini@konsulko.com>

Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1e5eca7d 10-Apr-2017 Troy Kisky <troy.kisky@boundarydevices.com>

usb: return 0 from usb_stor_get_info even if removable media

This fixes a regression caused by

commit 07b2b78ce4bc8ae25e066c65245eaf58c0d9a67c
dm: usb: Convert USB storage to use driver-model for block devs

which caused part_init to be called when it was not previously.
Without this patch, the following happens when a USB sd card reader is used.

=> usb start
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1 for devices... 3 USB Device(s) found
scanning usb for storage devices... Device NOT ready
Request Sense returned 02 3A 00
### ERROR ### Please RESET the board ###

This happens because dev_desc->blksz is 0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

# b984700c 21-Dec-2016 Michal Simek <michal.simek@amd.com>

usb: storage: Show number of storage devices detected for DM_USB

By enabling DM_USB information about number of storage devices
was lost.
Get this information back simply by printing number of devices detected
via BLK uclass.

For example:
scanning bus 0 for devices... 7 USB Device(s) found
scanning usb for storage devices... 3 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 8319aeb1 06-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9107c973 01-May-2016 Simon Glass <sjg@chromium.org>

dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 57ebf67b 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0543bf6 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b94fc851 16-Mar-2016 Simon Glass <sjg@chromium.org>

usb: Correct return value in usb_stor_info()

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# a6f70a3d 15-Mar-2016 Vagrant Cascadian <vagrant@debian.org>

Fix spelling of "transferred".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 07b2b78c 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Convert USB storage to use driver-model for block devs

Update this code to support CONFIG_BLK. Each USB storage device can have
one or more block devices as children, each one representing a LUN
(logical unit) of the USB device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 9807c3b7 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Tidy up storage code ready for driver model conversion

Adjust a few things so that the addition of driver-models support involved
adding code rather than also changing it. This makes the patches easier to
review.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c89e79d4 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Avoid exceeding available array size for storage devices

The limit on storage devices is USB_MAX_STOR_DEV but we use one extra
element while probing to see if a device is a storage device. Avoid this,
since it causes memory corruption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# bcce53d0 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 3e8bd469 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: part: Rename some partition functions

Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4101f687 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: Drop the block_dev_desc_t typedef

Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4ef79099 07-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7c4213f6 07-Dec-2015 Stephen Warren <swarren@nvidia.com>

block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 70caa971 03-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Allow up to 7 storage devices

The current limit of 5 is not enough for the driver model USB tests. Really
we should not have a limit but the driver model code still uses the
usb_dev_desc[] array, which has a limit.

Increasing the limit by 2 should not bother anyone. Adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f5fb78a2 11-Oct-2015 Tom Rini <trini@konsulko.com>

common/usb_storage.c: Clean up usb_storage_probe()

We have the protocol and subclass variables which are used only in
disabled debug code. This code dates back to the initial git import and
seemingly dead code so remove it.

This was detected by Coverity (CID 131117)

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcbe3d15 28-Sep-2015 Simon Glass <sjg@chromium.org>

dm: Rename dev_get_parentdata() to dev_get_parent_priv()

The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

# cf92e05c 02-Sep-2015 Simon Glass <sjg@chromium.org>

Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header

Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# abb59cff 06-Jul-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust the USB_DEVICE() macro naming

In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
We should follow the same convention in U-Boot. Rename the existing
USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
macro from Linux for use in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>

# acf277af 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Convert usb_storage to driver model

Add support for scanning USB storage devices with driver model. This mostly
involves adding a USB device ID for storage devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 91557579 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move storage device scanning into its own function

The usb_stor_scan() function is quite long, so split out the code that scans
each device into its own function. Also, rather than setting up the block
device list once at the start, set it up as each device is scanned. This
makes it possible to use this code from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7fc2c1ea 16-Apr-2015 Simon Glass <sjg@chromium.org>

Revert "usb_storage : scan all interfaces to find a storage device"

This reverts commit cd749658d5994978579628a6333e5c2a6c8ec632.

The conflicts with this commit are hard for me to figure out. I will re-apply
it later.

# 05108132 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust usb_storage to work with sandbox

With a few tweaks we can compile this code with sandbox and enable testing
of the USB storage layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 84073b6f 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Simply device finding code in usb_storage

The for() loop is not needed since the value is immediately accessible.
Use this instead to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1d5827a1 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2e17c87e 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move USB storage definitions to usb_defs.h

These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f6570871 01-Apr-2015 Sergey Temerkhanov <s.temerkhanov@gmail.com>

usb_storage:Fix USB storage capacity detection on 64 bit architectures

This patch fixes USB storage capacity detection breakage on 64-bit systems
which arises due to 'unsigned long' length difference. Old code assumes that
to be 32 bit and breaks because of inappropriate response buffer layout.
Also this fixes a number of build warnings and changes big-endian values
treatment style to be architecture-independent

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>

# cd749658 04-Mar-2015 Franck Jullien <franck.jullien@gmail.com>

usb_storage : scan all interfaces to find a storage device

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>

# 6a559bbe 07-Nov-2014 Soeren Moch <smoch@web.de>

usb_storage: blacklist Enclosure Service Devices

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>

# 4fd074de 15-Oct-2014 Simon Glass <sjg@chromium.org>

usb: Use correct printf() format string for uintptr_t

Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ff8fef56 14-Jun-2013 Sascha Silbe <t-uboot@infra-silbe.de>

Fix block device accesses beyond 2TiB

With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>

# 605bd75a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

USB: Some cleanup prior to USB 3.0 interface addition

Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# ceb4972a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

usb: common: Weed out USB_**_PRINTFs from usb framework

USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# 0472fbfd 09-Apr-2013 Egbert Eich <eich@suse.com>

part/dev_desc: Add log2 of blocksize to block_dev_desc data struct

log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>

# 8b57e2f0 12-Dec-2012 Vincent Palatin <vpalatin@chromium.org>

usb: properly detect empty mass storage media reader

When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 199adb60 29-Oct-2012 Kim Phillips <kim.phillips@freescale.com>

common/misc: sparse fixes

command.c:44:38: error: bad constant expression
dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
hush.c:2175:20: warning: Using plain integer as NULL pointer
hush.c:2175:34: warning: Using plain integer as NULL pointer
hush.c:2210:41: warning: Using plain integer as NULL pointer
hush.c:2216:45: warning: Using plain integer as NULL pointer
hush.c:2249:25: warning: Using plain integer as NULL pointer
hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
hush.c:3295:34: warning: Using plain integer as NULL pointer
hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
image.c:1282:29: warning: Using plain integer as NULL pointer
image.c:1315:41: warning: Using plain integer as NULL pointer
image.c:1330:25: warning: Using plain integer as NULL pointer
image.c:1706:25: warning: Using plain integer as NULL pointer
main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
usb_storage.c:440:48: warning: Using plain integer as NULL pointer
usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
usb_storage.c:629:55: warning: Using plain integer as NULL pointer
usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
usb_storage.c:675:43: warning: Using plain integer as NULL pointer
usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

note: hush.c's nesting_level deleted because not used.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# e81e79ed 12-Oct-2012 Gabe Black <gabeblack@chromium.org>

usb: Support the CONFIG_SYS_64BIT_LBA option

usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 93c2582f 25-Sep-2012 Lucas Stach <dev@lynxeye.de>

usb: add support for multiple usb controllers

Allows to initialize more than one USB controller at once.

v2: print message when controller stop fails

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>

# b7006958 30-Jul-2012 Jim Shimer <jamesshimer@motorola.com>

usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

# 3e8581bb 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
- Rebase against the latest u-boot-usb master.
- Replace typedef with #define.
- Use the existing flags struct field instead of adding a new field.
- Remove the setter function.
- Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>

# 4bee5c83 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# cffcc503 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# 1b4bd0e6 09-Jul-2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

usb_storage: fix ehci driver max transfer size

The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage:
Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in
usb_storage as it wrongly assumes that every transfer can use
4096 bytes per qt_buffer. This is wrong if the start address of
the data is not page aligned to 4096 bytes and leads to 'EHCI
timed out on TD' messages because of 'out of buffer pointers'
in ehci_td_buffer function.

The bug appears during load of a fragmented file and
read from or write to an unaligned memory address.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# f5766139 03-Apr-2012 Puneet Saxena <puneets@nvidia.com>

USB: Align buffers at cacheline

This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>

# 5b84dd67 05-Mar-2012 Mike Frysinger <vapier@gentoo.org>

usb: replace wait_ms() with mdelay()

Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>

# 5dd95cf9 21-Dec-2011 Kyle Moffett <Kyle.D.Moffett@boeing.com>

usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

# 4b210e8b 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash subsequent warnings in usb_storage.c

usb_storage.c: In function ‘us_one_transfer’:
usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_reset’:
usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_comdat’:
usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_transport’:
usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_transport’:
usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Remy Bohmer <linux@bohmer.net>

# 86bd3ff8 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash warning in usb_storage.c

usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>

# f092f15d 04-Oct-2011 Wolfgang Denk <wd@denx.de>

Revert "GCC4.6: Convert various empty macros to inline functions"

This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac.

The commit causes build breakage for a number of boards. This results
from the fact that now the arguments of debug() actually get
referenced (even if there is hope that the compiler will optimize
away the debug() call). The obvious fix to that probem (change the
code to always declare the referenced variables and data structures)
increases the code size, and was this rejected. So it was decided to
revert this commit until a better solution is found.

# 60ce53cf 26-Sep-2011 Marek Vasut <marex@denx.de>

GCC4.6: Convert various empty macros to inline functions

Fix the following gcc4.6 problems:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]
asix.c: In function ‘asix_init’:
asix.c:317:6: warning: variable ‘rx_ctl’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_parse_config’:
usb.c:331:17: warning: variable ‘ch’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_port_connect_change’:
usb.c:1123:29: warning: variable ‘portchange’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_configure’:
usb.c:1183:25: warning: variable ‘hubsts’ set but not used
[-Wunused-but-set-variable]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>

# df3fc526 23-May-2011 Matthew McClintock <msm@freescale.com>

disk/part.c: Make features optional

If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>

# 6052cbab 03-Feb-2011 Loïc Minier <loic.minier@linaro.org>

Fix misc spelling errors found by lintian

Signed-off-by: Lo�c Minier <loic.minier@linaro.org>

# 56887e27 24-Mar-2011 Erik Hansen <erik@makarta.com>

Remove unnecessary reset in usb_stor_get_info

The reset request in usb_stor_get_info is causing issues with some usb
sticks. Some of these sticks vendor_id/product_id have been hardcoded to
not reset but better is to remove the reset altogether. It is not needed.

Signed-off-by: Erik Hansen <erik@makarta.com>

# 2ff12285 20-Oct-2010 Mike Frysinger <vapier@gentoo.org>

usb_storage: constify us_direction lookup table

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 99e9ed1f 05-Oct-2010 Ludovic Courtès <ludo@gnu.org>

usb: Add support for multiple-LUN mass storage devices

This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device. It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>

# 226fa9bb 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: change progress output in debug() message

The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
. <<==== here
29 file.001
29 file.002
29 file.003
29 file.004
29 file.005
29 file.006
29 file.007
29 file.008
29 file.009
29 file.010
29 file.011
29 file.012
29 file.013
29 file.014
29 file.015
29 file.016
. <<==== here
29 file.017
29 file.018
29 file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# a17c548b 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: initialize device type

The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

=> usb part
print_part of 0

Partition Map for USB device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 0 2031616 f8

print_part of 1
## Unknown partition table

print_part of 2
## Unknown partition table

print_part of 3
## Unknown partition table

print_part of 4
## Unknown partition table
=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# fac71cc4 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage probe

While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# aaad108b 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage count

Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# 127e1084 02-Nov-2009 Mahavir Jain <mjain@marvell.com>

usb: write command for RAW partition.

This patch implements write support to usb device with raw partition.
It will be useful for filesystem write support to usb device from
u-boot in future.

Tested with writing kernel image to raw usb disk & booting with usb
read command into ram.

[Note: run usb part to get info about start sector & number of
sectors on a partition for usb write operation.]

Signed-off-by: Mahavir Jain <mjain@marvell.com>

# 8f8bd565 30-Oct-2009 Tom Rix <Tom.Rix@windriver.com>

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

unsigned char bRefresh
unsigned char bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h. The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>

# 792a09eb 13-May-2009 Detlev Zundel <dzu@denx.de>

Fix e-mail address of Gary Jennejohn.

Signed-off-by: Detlev Zundel <dzu@denx.de>

# 9704f9ca 28-Oct-2008 Abraham, Thomas <t-abraham@ti.com>

USB: Remove LUN number from CDB

The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB.

Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# c7d703f3 01-Jan-2009 Mike Frysinger <vapier@gentoo.org>

usb.h: use standard __LITTLE_ENDIAN from Linux headers

Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# 14e4111c 01-Jan-2009 Bryan Wu <Bryan.Wu@analog.com>

usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb drive

The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4
does not like to be reset, so check for it.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# a0cb3fc3 10-Dec-2008 Michael Trimarchi <trimarchi@gandalf.sssup.it>

USB storage cleanup patch

Cleanup usb storage

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# d6e9ee92 12-Aug-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

common: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# d0ff51ba 14-Jul-2008 Wolfgang Denk <wd@denx.de>

Code cleanup: fix old style assignment ambiguities like "=-" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c918261c 21-May-2008 Christian Eggers <ceggers@gmx.de>

USB: replace old swap_ with proper endianess conversion macros

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 1aeed8d7 13-Apr-2008 Wolfgang Denk <wd@denx.de>

Coding Style cleanup; update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b9e749e9 26-Mar-2008 Markus Klotzbuecher <mk@denx.de>

USB, Storage: fix a bug introduced in commit
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info
to only print only information on one storage device, but not for
multiple.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# f6b44e0e 24-Mar-2008 Aras Vaichas <arasv@magtech.com.au>

USB Storage, add meaningful return value

This patch changes the "usb storage" command to return success if it
finds a USB storage device, otherwise it returns error.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 409ecdc0 18-Nov-2007 Wolfgang Denk <wd@denx.de>

Fix compiler warnings for PPC systems. Update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 90253178 10-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/: Remove lingering references to CFG_CMD_* symbols.

Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# c3517f91 08-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDS

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# b453960d 11-Jun-2007 Jon Loeliger <jdl@jdl.com>

common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).

This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# eb867a76 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers

Block device read/write is anonymous data; there is no need to use a
typed pointer. void * is fine. Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 735dd97b 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 1_4] Merge common get_dev() routines for block devices

Each of the filesystem drivers duplicate the get_dev routine. This change
merges them into a single function in part.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 73652699 19-Oct-2006 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# ddde6b7c 22-Aug-2006 Bartlomiej Sieka <tur@semihalf.com>

Add a fix for a buggy USB device on the FO300 board.

# f88a0ae6 13-Jul-2006 Bartlomiej Sieka <tur@semihalf.com>

Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.

# 77ddac94 13-Oct-2005 Wolfgang Denk <wd@denx.de>

Cleanup for GCC-4.x

# 460c322f 03-Aug-2005 Wolfgang Denk <wd@denx.de>

(re)enabled scsi commands do_scsi() and do_scsiboot()
Patch by Denis Peter, 06 Dec 2004

# 095b8a37 02-Aug-2005 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# 9c998aa8 21-Jul-2005 Wolfgang Denk <wd@denx.de>

Fix low-level OHCI transfers for ARM920t and MPC5xxx

A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.

# 2729af9d 03-May-2004 Wolfgang Denk <wd@denx.de>

* Fix minor NAND JFFS2 related issue

* Fixes for SL811 USB controller:
- implement workaround for broken memory stick
- improve error handling

* Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better
cope with congested networks.

# f8d813e3 02-Mar-2004 Wolfgang Denk <wd@denx.de>

* Fix SDRAM timings for LITE5200 / IceCube board

* Handle Auti-MDIX / connection status for INCA-IP

* Fix USB problems when attempting to read 0 bytes

# 80885a9d 26-Feb-2004 Wolfgang Denk <wd@denx.de>

* Patch by Markus Pietrek, 24 Feb 2004:
NS9750 DevBoard added

* Patch by Pierre AUBERT, 24 Feb 2004
add USB support for MPC5200

* Patch by Steven Scholz, 24 Feb 2004:
- fix MII commands to use values from last command

* Patch by Torsten Demke, 24 Feb 2004:
Add support for the eXalion platform (SPSW-8240, F-30, F-300)

# f54ebdfa 17-Sep-2003 Wolfgang Denk <wd@denx.de>

Add auto-update code for TRAB board using USB memory sticks

# a43278a4 11-Sep-2003 Wolfgang Denk <wd@denx.de>

* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices

* Patch by Denis Peter, 11 Sep 2003:
- fix USB data pointer assignment for bulk only transfer.
- prevent to display erased directories in FAT filesystem.

* Change output format for NAND flash - make it look like for other
memory, too

# 149dded2 10-Sep-2003 Wolfgang Denk <wd@denx.de>

* Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD

# 8bde7f77 27-Jun-2003 Wolfgang Denk <wd@denx.de>

* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)

# affae2bf 17-Aug-2002 Wolfgang Denk <wd@denx.de>

Initial revision

# 0ccb0ac5 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: usb: Add a bootdev driver

Add a bootdev driver for USB host. It can use the distro boot mechanism to
locate a file, or any other available bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8c9812a5 08-Mar-2022 AKASHI Takahiro <takahiro.akashi@linaro.org>

usb: storage: call device_probe() after scanning

Every time a usb bus/port is scanned and a new device is detected,
we want to call device_probe() as it will give us a chance to run
additional post-processings for some purposes.

In particular, support for creating partitions on a device will be added.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0cf207ec 27-Sep-2021 Wolfgang Denk <wd@denx.de>

WS cleanup: remove SPACE(s) followed by TAB

Signed-off-by: Wolfgang Denk <wd@denx.de>

# bc0b99bd 06-Jan-2021 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2021.04

arm64:
- DT updates

microblaze:
- Add support for NOR device support

spi:
- Fix unaligned data write issue

nand:
- Minor code change

xilinx:
- Fru fix in limit calculation
- Fill git repo link for all Xilinx boards

video:
- Add support for seps525 spi display

tools:
- Minor Vitis file support

cmd/common
- Minor code indentation fixes

serial:
- Uartlite debug uart initialization fix


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@amd.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31232de0 06-Apr-2020 Marek Vasut <marex@denx.de>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]

# da3d1c49 05-Oct-2019 Marek Vasut <marex@denx.de>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 7d6fd7f0 15-Sep-2019 Marek Vasut <marex@denx.de>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# d0851c89 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dee37fc9 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

typedef unsigned int u32;
typedef unsigned long uintptr_t;
typedef unsigned long long u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly. You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 72ac8f3f 27-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# ea7fad91 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled

When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 6158d0b4 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Refactor to use max_xfer_blk from struct us_data

This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# b9560ad6 14-Jun-2017 Simon Glass <sjg@chromium.org>

dm: scsi: Drop the ccb typedef

We should not be using typedefs in U-Boot and 'ccb' is a pretty short
name. It is also used with variables. Drop the typedef and use 'struct'
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8850c5d5 12-May-2017 Tom Rini <trini@konsulko.com>

Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1e5eca7d 10-Apr-2017 Troy Kisky <troy.kisky@boundarydevices.com>

usb: return 0 from usb_stor_get_info even if removable media

This fixes a regression caused by

commit 07b2b78ce4bc8ae25e066c65245eaf58c0d9a67c
dm: usb: Convert USB storage to use driver-model for block devs

which caused part_init to be called when it was not previously.
Without this patch, the following happens when a USB sd card reader is used.

=> usb start
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1 for devices... 3 USB Device(s) found
scanning usb for storage devices... Device NOT ready
Request Sense returned 02 3A 00
### ERROR ### Please RESET the board ###

This happens because dev_desc->blksz is 0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

# b984700c 21-Dec-2016 Michal Simek <michal.simek@amd.com>

usb: storage: Show number of storage devices detected for DM_USB

By enabling DM_USB information about number of storage devices
was lost.
Get this information back simply by printing number of devices detected
via BLK uclass.

For example:
scanning bus 0 for devices... 7 USB Device(s) found
scanning usb for storage devices... 3 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 8319aeb1 06-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9107c973 01-May-2016 Simon Glass <sjg@chromium.org>

dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 57ebf67b 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0543bf6 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b94fc851 16-Mar-2016 Simon Glass <sjg@chromium.org>

usb: Correct return value in usb_stor_info()

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# a6f70a3d 15-Mar-2016 Vagrant Cascadian <vagrant@debian.org>

Fix spelling of "transferred".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 07b2b78c 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Convert USB storage to use driver-model for block devs

Update this code to support CONFIG_BLK. Each USB storage device can have
one or more block devices as children, each one representing a LUN
(logical unit) of the USB device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 9807c3b7 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Tidy up storage code ready for driver model conversion

Adjust a few things so that the addition of driver-models support involved
adding code rather than also changing it. This makes the patches easier to
review.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c89e79d4 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Avoid exceeding available array size for storage devices

The limit on storage devices is USB_MAX_STOR_DEV but we use one extra
element while probing to see if a device is a storage device. Avoid this,
since it causes memory corruption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# bcce53d0 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 3e8bd469 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: part: Rename some partition functions

Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4101f687 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: Drop the block_dev_desc_t typedef

Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4ef79099 07-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7c4213f6 07-Dec-2015 Stephen Warren <swarren@nvidia.com>

block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 70caa971 03-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Allow up to 7 storage devices

The current limit of 5 is not enough for the driver model USB tests. Really
we should not have a limit but the driver model code still uses the
usb_dev_desc[] array, which has a limit.

Increasing the limit by 2 should not bother anyone. Adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f5fb78a2 11-Oct-2015 Tom Rini <trini@konsulko.com>

common/usb_storage.c: Clean up usb_storage_probe()

We have the protocol and subclass variables which are used only in
disabled debug code. This code dates back to the initial git import and
seemingly dead code so remove it.

This was detected by Coverity (CID 131117)

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcbe3d15 28-Sep-2015 Simon Glass <sjg@chromium.org>

dm: Rename dev_get_parentdata() to dev_get_parent_priv()

The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

# cf92e05c 02-Sep-2015 Simon Glass <sjg@chromium.org>

Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header

Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# abb59cff 06-Jul-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust the USB_DEVICE() macro naming

In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
We should follow the same convention in U-Boot. Rename the existing
USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
macro from Linux for use in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>

# acf277af 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Convert usb_storage to driver model

Add support for scanning USB storage devices with driver model. This mostly
involves adding a USB device ID for storage devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 91557579 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move storage device scanning into its own function

The usb_stor_scan() function is quite long, so split out the code that scans
each device into its own function. Also, rather than setting up the block
device list once at the start, set it up as each device is scanned. This
makes it possible to use this code from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7fc2c1ea 16-Apr-2015 Simon Glass <sjg@chromium.org>

Revert "usb_storage : scan all interfaces to find a storage device"

This reverts commit cd749658d5994978579628a6333e5c2a6c8ec632.

The conflicts with this commit are hard for me to figure out. I will re-apply
it later.

# 05108132 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust usb_storage to work with sandbox

With a few tweaks we can compile this code with sandbox and enable testing
of the USB storage layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 84073b6f 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Simply device finding code in usb_storage

The for() loop is not needed since the value is immediately accessible.
Use this instead to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1d5827a1 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2e17c87e 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move USB storage definitions to usb_defs.h

These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f6570871 01-Apr-2015 Sergey Temerkhanov <s.temerkhanov@gmail.com>

usb_storage:Fix USB storage capacity detection on 64 bit architectures

This patch fixes USB storage capacity detection breakage on 64-bit systems
which arises due to 'unsigned long' length difference. Old code assumes that
to be 32 bit and breaks because of inappropriate response buffer layout.
Also this fixes a number of build warnings and changes big-endian values
treatment style to be architecture-independent

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>

# cd749658 04-Mar-2015 Franck Jullien <franck.jullien@gmail.com>

usb_storage : scan all interfaces to find a storage device

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>

# 6a559bbe 07-Nov-2014 Soeren Moch <smoch@web.de>

usb_storage: blacklist Enclosure Service Devices

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>

# 4fd074de 15-Oct-2014 Simon Glass <sjg@chromium.org>

usb: Use correct printf() format string for uintptr_t

Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ff8fef56 14-Jun-2013 Sascha Silbe <t-uboot@infra-silbe.de>

Fix block device accesses beyond 2TiB

With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>

# 605bd75a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

USB: Some cleanup prior to USB 3.0 interface addition

Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# ceb4972a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

usb: common: Weed out USB_**_PRINTFs from usb framework

USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# 0472fbfd 09-Apr-2013 Egbert Eich <eich@suse.com>

part/dev_desc: Add log2 of blocksize to block_dev_desc data struct

log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>

# 8b57e2f0 12-Dec-2012 Vincent Palatin <vpalatin@chromium.org>

usb: properly detect empty mass storage media reader

When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 199adb60 29-Oct-2012 Kim Phillips <kim.phillips@freescale.com>

common/misc: sparse fixes

command.c:44:38: error: bad constant expression
dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
hush.c:2175:20: warning: Using plain integer as NULL pointer
hush.c:2175:34: warning: Using plain integer as NULL pointer
hush.c:2210:41: warning: Using plain integer as NULL pointer
hush.c:2216:45: warning: Using plain integer as NULL pointer
hush.c:2249:25: warning: Using plain integer as NULL pointer
hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
hush.c:3295:34: warning: Using plain integer as NULL pointer
hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
image.c:1282:29: warning: Using plain integer as NULL pointer
image.c:1315:41: warning: Using plain integer as NULL pointer
image.c:1330:25: warning: Using plain integer as NULL pointer
image.c:1706:25: warning: Using plain integer as NULL pointer
main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
usb_storage.c:440:48: warning: Using plain integer as NULL pointer
usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
usb_storage.c:629:55: warning: Using plain integer as NULL pointer
usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
usb_storage.c:675:43: warning: Using plain integer as NULL pointer
usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

note: hush.c's nesting_level deleted because not used.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# e81e79ed 12-Oct-2012 Gabe Black <gabeblack@chromium.org>

usb: Support the CONFIG_SYS_64BIT_LBA option

usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 93c2582f 25-Sep-2012 Lucas Stach <dev@lynxeye.de>

usb: add support for multiple usb controllers

Allows to initialize more than one USB controller at once.

v2: print message when controller stop fails

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>

# b7006958 30-Jul-2012 Jim Shimer <jamesshimer@motorola.com>

usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

# 3e8581bb 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
- Rebase against the latest u-boot-usb master.
- Replace typedef with #define.
- Use the existing flags struct field instead of adding a new field.
- Remove the setter function.
- Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>

# 4bee5c83 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# cffcc503 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# 1b4bd0e6 09-Jul-2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

usb_storage: fix ehci driver max transfer size

The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage:
Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in
usb_storage as it wrongly assumes that every transfer can use
4096 bytes per qt_buffer. This is wrong if the start address of
the data is not page aligned to 4096 bytes and leads to 'EHCI
timed out on TD' messages because of 'out of buffer pointers'
in ehci_td_buffer function.

The bug appears during load of a fragmented file and
read from or write to an unaligned memory address.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# f5766139 03-Apr-2012 Puneet Saxena <puneets@nvidia.com>

USB: Align buffers at cacheline

This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>

# 5b84dd67 05-Mar-2012 Mike Frysinger <vapier@gentoo.org>

usb: replace wait_ms() with mdelay()

Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>

# 5dd95cf9 21-Dec-2011 Kyle Moffett <Kyle.D.Moffett@boeing.com>

usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

# 4b210e8b 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash subsequent warnings in usb_storage.c

usb_storage.c: In function ‘us_one_transfer’:
usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_reset’:
usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_comdat’:
usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_transport’:
usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_transport’:
usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Remy Bohmer <linux@bohmer.net>

# 86bd3ff8 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash warning in usb_storage.c

usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>

# f092f15d 04-Oct-2011 Wolfgang Denk <wd@denx.de>

Revert "GCC4.6: Convert various empty macros to inline functions"

This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac.

The commit causes build breakage for a number of boards. This results
from the fact that now the arguments of debug() actually get
referenced (even if there is hope that the compiler will optimize
away the debug() call). The obvious fix to that probem (change the
code to always declare the referenced variables and data structures)
increases the code size, and was this rejected. So it was decided to
revert this commit until a better solution is found.

# 60ce53cf 26-Sep-2011 Marek Vasut <marex@denx.de>

GCC4.6: Convert various empty macros to inline functions

Fix the following gcc4.6 problems:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]
asix.c: In function ‘asix_init’:
asix.c:317:6: warning: variable ‘rx_ctl’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_parse_config’:
usb.c:331:17: warning: variable ‘ch’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_port_connect_change’:
usb.c:1123:29: warning: variable ‘portchange’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_configure’:
usb.c:1183:25: warning: variable ‘hubsts’ set but not used
[-Wunused-but-set-variable]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>

# df3fc526 23-May-2011 Matthew McClintock <msm@freescale.com>

disk/part.c: Make features optional

If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>

# 6052cbab 03-Feb-2011 Loïc Minier <loic.minier@linaro.org>

Fix misc spelling errors found by lintian

Signed-off-by: Lo�c Minier <loic.minier@linaro.org>

# 56887e27 24-Mar-2011 Erik Hansen <erik@makarta.com>

Remove unnecessary reset in usb_stor_get_info

The reset request in usb_stor_get_info is causing issues with some usb
sticks. Some of these sticks vendor_id/product_id have been hardcoded to
not reset but better is to remove the reset altogether. It is not needed.

Signed-off-by: Erik Hansen <erik@makarta.com>

# 2ff12285 20-Oct-2010 Mike Frysinger <vapier@gentoo.org>

usb_storage: constify us_direction lookup table

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 99e9ed1f 05-Oct-2010 Ludovic Courtès <ludo@gnu.org>

usb: Add support for multiple-LUN mass storage devices

This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device. It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>

# 226fa9bb 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: change progress output in debug() message

The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
. <<==== here
29 file.001
29 file.002
29 file.003
29 file.004
29 file.005
29 file.006
29 file.007
29 file.008
29 file.009
29 file.010
29 file.011
29 file.012
29 file.013
29 file.014
29 file.015
29 file.016
. <<==== here
29 file.017
29 file.018
29 file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# a17c548b 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: initialize device type

The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

=> usb part
print_part of 0

Partition Map for USB device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 0 2031616 f8

print_part of 1
## Unknown partition table

print_part of 2
## Unknown partition table

print_part of 3
## Unknown partition table

print_part of 4
## Unknown partition table
=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# fac71cc4 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage probe

While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# aaad108b 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage count

Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# 127e1084 02-Nov-2009 Mahavir Jain <mjain@marvell.com>

usb: write command for RAW partition.

This patch implements write support to usb device with raw partition.
It will be useful for filesystem write support to usb device from
u-boot in future.

Tested with writing kernel image to raw usb disk & booting with usb
read command into ram.

[Note: run usb part to get info about start sector & number of
sectors on a partition for usb write operation.]

Signed-off-by: Mahavir Jain <mjain@marvell.com>

# 8f8bd565 30-Oct-2009 Tom Rix <Tom.Rix@windriver.com>

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

unsigned char bRefresh
unsigned char bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h. The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>

# 792a09eb 13-May-2009 Detlev Zundel <dzu@denx.de>

Fix e-mail address of Gary Jennejohn.

Signed-off-by: Detlev Zundel <dzu@denx.de>

# 9704f9ca 28-Oct-2008 Abraham, Thomas <t-abraham@ti.com>

USB: Remove LUN number from CDB

The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB.

Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# c7d703f3 01-Jan-2009 Mike Frysinger <vapier@gentoo.org>

usb.h: use standard __LITTLE_ENDIAN from Linux headers

Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# 14e4111c 01-Jan-2009 Bryan Wu <Bryan.Wu@analog.com>

usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb drive

The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4
does not like to be reset, so check for it.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# a0cb3fc3 10-Dec-2008 Michael Trimarchi <trimarchi@gandalf.sssup.it>

USB storage cleanup patch

Cleanup usb storage

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# d6e9ee92 12-Aug-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

common: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# d0ff51ba 14-Jul-2008 Wolfgang Denk <wd@denx.de>

Code cleanup: fix old style assignment ambiguities like "=-" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c918261c 21-May-2008 Christian Eggers <ceggers@gmx.de>

USB: replace old swap_ with proper endianess conversion macros

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 1aeed8d7 13-Apr-2008 Wolfgang Denk <wd@denx.de>

Coding Style cleanup; update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b9e749e9 26-Mar-2008 Markus Klotzbuecher <mk@denx.de>

USB, Storage: fix a bug introduced in commit
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info
to only print only information on one storage device, but not for
multiple.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# f6b44e0e 24-Mar-2008 Aras Vaichas <arasv@magtech.com.au>

USB Storage, add meaningful return value

This patch changes the "usb storage" command to return success if it
finds a USB storage device, otherwise it returns error.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 409ecdc0 18-Nov-2007 Wolfgang Denk <wd@denx.de>

Fix compiler warnings for PPC systems. Update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 90253178 10-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/: Remove lingering references to CFG_CMD_* symbols.

Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# c3517f91 08-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDS

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# b453960d 11-Jun-2007 Jon Loeliger <jdl@jdl.com>

common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).

This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# eb867a76 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers

Block device read/write is anonymous data; there is no need to use a
typed pointer. void * is fine. Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 735dd97b 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 1_4] Merge common get_dev() routines for block devices

Each of the filesystem drivers duplicate the get_dev routine. This change
merges them into a single function in part.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 73652699 19-Oct-2006 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# ddde6b7c 22-Aug-2006 Bartlomiej Sieka <tur@semihalf.com>

Add a fix for a buggy USB device on the FO300 board.

# f88a0ae6 13-Jul-2006 Bartlomiej Sieka <tur@semihalf.com>

Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.

# 77ddac94 13-Oct-2005 Wolfgang Denk <wd@denx.de>

Cleanup for GCC-4.x

# 460c322f 03-Aug-2005 Wolfgang Denk <wd@denx.de>

(re)enabled scsi commands do_scsi() and do_scsiboot()
Patch by Denis Peter, 06 Dec 2004

# 095b8a37 02-Aug-2005 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# 9c998aa8 21-Jul-2005 Wolfgang Denk <wd@denx.de>

Fix low-level OHCI transfers for ARM920t and MPC5xxx

A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.

# 2729af9d 03-May-2004 Wolfgang Denk <wd@denx.de>

* Fix minor NAND JFFS2 related issue

* Fixes for SL811 USB controller:
- implement workaround for broken memory stick
- improve error handling

* Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better
cope with congested networks.

# f8d813e3 02-Mar-2004 Wolfgang Denk <wd@denx.de>

* Fix SDRAM timings for LITE5200 / IceCube board

* Handle Auti-MDIX / connection status for INCA-IP

* Fix USB problems when attempting to read 0 bytes

# 80885a9d 26-Feb-2004 Wolfgang Denk <wd@denx.de>

* Patch by Markus Pietrek, 24 Feb 2004:
NS9750 DevBoard added

* Patch by Pierre AUBERT, 24 Feb 2004
add USB support for MPC5200

* Patch by Steven Scholz, 24 Feb 2004:
- fix MII commands to use values from last command

* Patch by Torsten Demke, 24 Feb 2004:
Add support for the eXalion platform (SPSW-8240, F-30, F-300)

# f54ebdfa 17-Sep-2003 Wolfgang Denk <wd@denx.de>

Add auto-update code for TRAB board using USB memory sticks

# a43278a4 11-Sep-2003 Wolfgang Denk <wd@denx.de>

* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices

* Patch by Denis Peter, 11 Sep 2003:
- fix USB data pointer assignment for bulk only transfer.
- prevent to display erased directories in FAT filesystem.

* Change output format for NAND flash - make it look like for other
memory, too

# 149dded2 10-Sep-2003 Wolfgang Denk <wd@denx.de>

* Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD

# 8bde7f77 27-Jun-2003 Wolfgang Denk <wd@denx.de>

* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)

# affae2bf 17-Aug-2002 Wolfgang Denk <wd@denx.de>

Initial revision

# 8c9812a5 08-Mar-2022 AKASHI Takahiro <takahiro.akashi@linaro.org>

usb: storage: call device_probe() after scanning

Every time a usb bus/port is scanned and a new device is detected,
we want to call device_probe() as it will give us a chance to run
additional post-processings for some purposes.

In particular, support for creating partitions on a device will be added.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0cf207ec 27-Sep-2021 Wolfgang Denk <wd@denx.de>

WS cleanup: remove SPACE(s) followed by TAB

Signed-off-by: Wolfgang Denk <wd@denx.de>

# bc0b99bd 06-Jan-2021 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2021.04

arm64:
- DT updates

microblaze:
- Add support for NOR device support

spi:
- Fix unaligned data write issue

nand:
- Minor code change

xilinx:
- Fru fix in limit calculation
- Fill git repo link for all Xilinx boards

video:
- Add support for seps525 spi display

tools:
- Minor Vitis file support

cmd/common
- Minor code indentation fixes

serial:
- Uartlite debug uart initialization fix


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31232de0 06-Apr-2020 Marek Vasut <marex@denx.de>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]

# da3d1c49 05-Oct-2019 Marek Vasut <marex@denx.de>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 7d6fd7f0 15-Sep-2019 Marek Vasut <marex@denx.de>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# d0851c89 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dee37fc9 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

typedef unsigned int u32;
typedef unsigned long uintptr_t;
typedef unsigned long long u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly. You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 72ac8f3f 27-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# ea7fad91 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled

When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 6158d0b4 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Refactor to use max_xfer_blk from struct us_data

This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# b9560ad6 14-Jun-2017 Simon Glass <sjg@chromium.org>

dm: scsi: Drop the ccb typedef

We should not be using typedefs in U-Boot and 'ccb' is a pretty short
name. It is also used with variables. Drop the typedef and use 'struct'
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8850c5d5 12-May-2017 Tom Rini <trini@konsulko.com>

Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1e5eca7d 10-Apr-2017 Troy Kisky <troy.kisky@boundarydevices.com>

usb: return 0 from usb_stor_get_info even if removable media

This fixes a regression caused by

commit 07b2b78ce4bc8ae25e066c65245eaf58c0d9a67c
dm: usb: Convert USB storage to use driver-model for block devs

which caused part_init to be called when it was not previously.
Without this patch, the following happens when a USB sd card reader is used.

=> usb start
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1 for devices... 3 USB Device(s) found
scanning usb for storage devices... Device NOT ready
Request Sense returned 02 3A 00
### ERROR ### Please RESET the board ###

This happens because dev_desc->blksz is 0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

# b984700c 21-Dec-2016 Michal Simek <michal.simek@xilinx.com>

usb: storage: Show number of storage devices detected for DM_USB

By enabling DM_USB information about number of storage devices
was lost.
Get this information back simply by printing number of devices detected
via BLK uclass.

For example:
scanning bus 0 for devices... 7 USB Device(s) found
scanning usb for storage devices... 3 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 8319aeb1 06-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9107c973 01-May-2016 Simon Glass <sjg@chromium.org>

dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 57ebf67b 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0543bf6 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b94fc851 16-Mar-2016 Simon Glass <sjg@chromium.org>

usb: Correct return value in usb_stor_info()

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# a6f70a3d 15-Mar-2016 Vagrant Cascadian <vagrant@debian.org>

Fix spelling of "transferred".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 07b2b78c 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Convert USB storage to use driver-model for block devs

Update this code to support CONFIG_BLK. Each USB storage device can have
one or more block devices as children, each one representing a LUN
(logical unit) of the USB device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 9807c3b7 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Tidy up storage code ready for driver model conversion

Adjust a few things so that the addition of driver-models support involved
adding code rather than also changing it. This makes the patches easier to
review.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c89e79d4 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Avoid exceeding available array size for storage devices

The limit on storage devices is USB_MAX_STOR_DEV but we use one extra
element while probing to see if a device is a storage device. Avoid this,
since it causes memory corruption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# bcce53d0 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 3e8bd469 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: part: Rename some partition functions

Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4101f687 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: Drop the block_dev_desc_t typedef

Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4ef79099 07-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7c4213f6 07-Dec-2015 Stephen Warren <swarren@nvidia.com>

block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 70caa971 03-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Allow up to 7 storage devices

The current limit of 5 is not enough for the driver model USB tests. Really
we should not have a limit but the driver model code still uses the
usb_dev_desc[] array, which has a limit.

Increasing the limit by 2 should not bother anyone. Adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f5fb78a2 11-Oct-2015 Tom Rini <trini@konsulko.com>

common/usb_storage.c: Clean up usb_storage_probe()

We have the protocol and subclass variables which are used only in
disabled debug code. This code dates back to the initial git import and
seemingly dead code so remove it.

This was detected by Coverity (CID 131117)

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcbe3d15 28-Sep-2015 Simon Glass <sjg@chromium.org>

dm: Rename dev_get_parentdata() to dev_get_parent_priv()

The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

# cf92e05c 02-Sep-2015 Simon Glass <sjg@chromium.org>

Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header

Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# abb59cff 06-Jul-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust the USB_DEVICE() macro naming

In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
We should follow the same convention in U-Boot. Rename the existing
USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
macro from Linux for use in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>

# acf277af 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Convert usb_storage to driver model

Add support for scanning USB storage devices with driver model. This mostly
involves adding a USB device ID for storage devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 91557579 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move storage device scanning into its own function

The usb_stor_scan() function is quite long, so split out the code that scans
each device into its own function. Also, rather than setting up the block
device list once at the start, set it up as each device is scanned. This
makes it possible to use this code from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7fc2c1ea 16-Apr-2015 Simon Glass <sjg@chromium.org>

Revert "usb_storage : scan all interfaces to find a storage device"

This reverts commit cd749658d5994978579628a6333e5c2a6c8ec632.

The conflicts with this commit are hard for me to figure out. I will re-apply
it later.

# 05108132 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust usb_storage to work with sandbox

With a few tweaks we can compile this code with sandbox and enable testing
of the USB storage layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 84073b6f 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Simply device finding code in usb_storage

The for() loop is not needed since the value is immediately accessible.
Use this instead to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1d5827a1 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2e17c87e 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move USB storage definitions to usb_defs.h

These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f6570871 01-Apr-2015 Sergey Temerkhanov <s.temerkhanov@gmail.com>

usb_storage:Fix USB storage capacity detection on 64 bit architectures

This patch fixes USB storage capacity detection breakage on 64-bit systems
which arises due to 'unsigned long' length difference. Old code assumes that
to be 32 bit and breaks because of inappropriate response buffer layout.
Also this fixes a number of build warnings and changes big-endian values
treatment style to be architecture-independent

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>

# cd749658 04-Mar-2015 Franck Jullien <franck.jullien@gmail.com>

usb_storage : scan all interfaces to find a storage device

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>

# 6a559bbe 07-Nov-2014 Soeren Moch <smoch@web.de>

usb_storage: blacklist Enclosure Service Devices

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>

# 4fd074de 15-Oct-2014 Simon Glass <sjg@chromium.org>

usb: Use correct printf() format string for uintptr_t

Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ff8fef56 14-Jun-2013 Sascha Silbe <t-uboot@infra-silbe.de>

Fix block device accesses beyond 2TiB

With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>

# 605bd75a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

USB: Some cleanup prior to USB 3.0 interface addition

Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# ceb4972a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

usb: common: Weed out USB_**_PRINTFs from usb framework

USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# 0472fbfd 09-Apr-2013 Egbert Eich <eich@suse.com>

part/dev_desc: Add log2 of blocksize to block_dev_desc data struct

log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>

# 8b57e2f0 12-Dec-2012 Vincent Palatin <vpalatin@chromium.org>

usb: properly detect empty mass storage media reader

When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 199adb60 29-Oct-2012 Kim Phillips <kim.phillips@freescale.com>

common/misc: sparse fixes

command.c:44:38: error: bad constant expression
dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
hush.c:2175:20: warning: Using plain integer as NULL pointer
hush.c:2175:34: warning: Using plain integer as NULL pointer
hush.c:2210:41: warning: Using plain integer as NULL pointer
hush.c:2216:45: warning: Using plain integer as NULL pointer
hush.c:2249:25: warning: Using plain integer as NULL pointer
hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
hush.c:3295:34: warning: Using plain integer as NULL pointer
hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
image.c:1282:29: warning: Using plain integer as NULL pointer
image.c:1315:41: warning: Using plain integer as NULL pointer
image.c:1330:25: warning: Using plain integer as NULL pointer
image.c:1706:25: warning: Using plain integer as NULL pointer
main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
usb_storage.c:440:48: warning: Using plain integer as NULL pointer
usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
usb_storage.c:629:55: warning: Using plain integer as NULL pointer
usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
usb_storage.c:675:43: warning: Using plain integer as NULL pointer
usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

note: hush.c's nesting_level deleted because not used.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# e81e79ed 12-Oct-2012 Gabe Black <gabeblack@chromium.org>

usb: Support the CONFIG_SYS_64BIT_LBA option

usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 93c2582f 25-Sep-2012 Lucas Stach <dev@lynxeye.de>

usb: add support for multiple usb controllers

Allows to initialize more than one USB controller at once.

v2: print message when controller stop fails

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>

# b7006958 30-Jul-2012 Jim Shimer <jamesshimer@motorola.com>

usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

# 3e8581bb 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
- Rebase against the latest u-boot-usb master.
- Replace typedef with #define.
- Use the existing flags struct field instead of adding a new field.
- Remove the setter function.
- Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>

# 4bee5c83 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# cffcc503 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# 1b4bd0e6 09-Jul-2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

usb_storage: fix ehci driver max transfer size

The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage:
Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in
usb_storage as it wrongly assumes that every transfer can use
4096 bytes per qt_buffer. This is wrong if the start address of
the data is not page aligned to 4096 bytes and leads to 'EHCI
timed out on TD' messages because of 'out of buffer pointers'
in ehci_td_buffer function.

The bug appears during load of a fragmented file and
read from or write to an unaligned memory address.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# f5766139 03-Apr-2012 Puneet Saxena <puneets@nvidia.com>

USB: Align buffers at cacheline

This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>

# 5b84dd67 05-Mar-2012 Mike Frysinger <vapier@gentoo.org>

usb: replace wait_ms() with mdelay()

Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>

# 5dd95cf9 21-Dec-2011 Kyle Moffett <Kyle.D.Moffett@boeing.com>

usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

# 4b210e8b 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash subsequent warnings in usb_storage.c

usb_storage.c: In function ‘us_one_transfer’:
usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_reset’:
usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_comdat’:
usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_transport’:
usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_transport’:
usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Remy Bohmer <linux@bohmer.net>

# 86bd3ff8 25-Oct-2011 Marek Vasut <marex@denx.de>

GCC4.6: Squash warning in usb_storage.c

usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>

# f092f15d 04-Oct-2011 Wolfgang Denk <wd@denx.de>

Revert "GCC4.6: Convert various empty macros to inline functions"

This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac.

The commit causes build breakage for a number of boards. This results
from the fact that now the arguments of debug() actually get
referenced (even if there is hope that the compiler will optimize
away the debug() call). The obvious fix to that probem (change the
code to always declare the referenced variables and data structures)
increases the code size, and was this rejected. So it was decided to
revert this commit until a better solution is found.

# 60ce53cf 26-Sep-2011 Marek Vasut <marex@denx.de>

GCC4.6: Convert various empty macros to inline functions

Fix the following gcc4.6 problems:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]
asix.c: In function ‘asix_init’:
asix.c:317:6: warning: variable ‘rx_ctl’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_parse_config’:
usb.c:331:17: warning: variable ‘ch’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_port_connect_change’:
usb.c:1123:29: warning: variable ‘portchange’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_configure’:
usb.c:1183:25: warning: variable ‘hubsts’ set but not used
[-Wunused-but-set-variable]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>

# df3fc526 23-May-2011 Matthew McClintock <msm@freescale.com>

disk/part.c: Make features optional

If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>

# 6052cbab 03-Feb-2011 Loïc Minier <loic.minier@linaro.org>

Fix misc spelling errors found by lintian

Signed-off-by: Lo�c Minier <loic.minier@linaro.org>

# 56887e27 24-Mar-2011 Erik Hansen <erik@makarta.com>

Remove unnecessary reset in usb_stor_get_info

The reset request in usb_stor_get_info is causing issues with some usb
sticks. Some of these sticks vendor_id/product_id have been hardcoded to
not reset but better is to remove the reset altogether. It is not needed.

Signed-off-by: Erik Hansen <erik@makarta.com>

# 2ff12285 20-Oct-2010 Mike Frysinger <vapier@gentoo.org>

usb_storage: constify us_direction lookup table

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 99e9ed1f 05-Oct-2010 Ludovic Courtès <ludo@gnu.org>

usb: Add support for multiple-LUN mass storage devices

This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device. It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>

# 226fa9bb 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: change progress output in debug() message

The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
. <<==== here
29 file.001
29 file.002
29 file.003
29 file.004
29 file.005
29 file.006
29 file.007
29 file.008
29 file.009
29 file.010
29 file.011
29 file.012
29 file.013
29 file.014
29 file.015
29 file.016
. <<==== here
29 file.017
29 file.018
29 file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# a17c548b 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: initialize device type

The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

=> usb part
print_part of 0

Partition Map for USB device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 0 2031616 f8

print_part of 1
## Unknown partition table

print_part of 2
## Unknown partition table

print_part of 3
## Unknown partition table

print_part of 4
## Unknown partition table
=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# fac71cc4 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage probe

While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# aaad108b 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage count

Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# 127e1084 02-Nov-2009 Mahavir Jain <mjain@marvell.com>

usb: write command for RAW partition.

This patch implements write support to usb device with raw partition.
It will be useful for filesystem write support to usb device from
u-boot in future.

Tested with writing kernel image to raw usb disk & booting with usb
read command into ram.

[Note: run usb part to get info about start sector & number of
sectors on a partition for usb write operation.]

Signed-off-by: Mahavir Jain <mjain@marvell.com>

# 8f8bd565 30-Oct-2009 Tom Rix <Tom.Rix@windriver.com>

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

unsigned char bRefresh
unsigned char bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h. The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>

# 792a09eb 13-May-2009 Detlev Zundel <dzu@denx.de>

Fix e-mail address of Gary Jennejohn.

Signed-off-by: Detlev Zundel <dzu@denx.de>

# 9704f9ca 28-Oct-2008 Abraham, Thomas <t-abraham@ti.com>

USB: Remove LUN number from CDB

The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB.

Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# c7d703f3 01-Jan-2009 Mike Frysinger <vapier@gentoo.org>

usb.h: use standard __LITTLE_ENDIAN from Linux headers

Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# 14e4111c 01-Jan-2009 Bryan Wu <Bryan.Wu@analog.com>

usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb drive

The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4
does not like to be reset, so check for it.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# a0cb3fc3 10-Dec-2008 Michael Trimarchi <trimarchi@gandalf.sssup.it>

USB storage cleanup patch

Cleanup usb storage

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# d6e9ee92 12-Aug-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

common: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# d0ff51ba 14-Jul-2008 Wolfgang Denk <wd@denx.de>

Code cleanup: fix old style assignment ambiguities like "=-" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c918261c 21-May-2008 Christian Eggers <ceggers@gmx.de>

USB: replace old swap_ with proper endianess conversion macros

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 1aeed8d7 13-Apr-2008 Wolfgang Denk <wd@denx.de>

Coding Style cleanup; update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b9e749e9 26-Mar-2008 Markus Klotzbuecher <mk@denx.de>

USB, Storage: fix a bug introduced in commit
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info
to only print only information on one storage device, but not for
multiple.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# f6b44e0e 24-Mar-2008 Aras Vaichas <arasv@magtech.com.au>

USB Storage, add meaningful return value

This patch changes the "usb storage" command to return success if it
finds a USB storage device, otherwise it returns error.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 409ecdc0 18-Nov-2007 Wolfgang Denk <wd@denx.de>

Fix compiler warnings for PPC systems. Update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 90253178 10-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/: Remove lingering references to CFG_CMD_* symbols.

Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# c3517f91 08-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDS

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# b453960d 11-Jun-2007 Jon Loeliger <jdl@jdl.com>

common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).

This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# eb867a76 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers

Block device read/write is anonymous data; there is no need to use a
typed pointer. void * is fine. Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 735dd97b 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 1_4] Merge common get_dev() routines for block devices

Each of the filesystem drivers duplicate the get_dev routine. This change
merges them into a single function in part.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 73652699 19-Oct-2006 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# ddde6b7c 22-Aug-2006 Bartlomiej Sieka <tur@semihalf.com>

Add a fix for a buggy USB device on the FO300 board.

# f88a0ae6 13-Jul-2006 Bartlomiej Sieka <tur@semihalf.com>

Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.

# 77ddac94 13-Oct-2005 Wolfgang Denk <wd@denx.de>

Cleanup for GCC-4.x

# 460c322f 03-Aug-2005 Wolfgang Denk <wd@denx.de>

(re)enabled scsi commands do_scsi() and do_scsiboot()
Patch by Denis Peter, 06 Dec 2004

# 095b8a37 02-Aug-2005 Wolfgang Denk <wd@denx.de>

Coding style cleanup

# 9c998aa8 21-Jul-2005 Wolfgang Denk <wd@denx.de>

Fix low-level OHCI transfers for ARM920t and MPC5xxx

A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.

# 2729af9d 03-May-2004 Wolfgang Denk <wd@denx.de>

* Fix minor NAND JFFS2 related issue

* Fixes for SL811 USB controller:
- implement workaround for broken memory stick
- improve error handling

* Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better
cope with congested networks.

# f8d813e3 02-Mar-2004 Wolfgang Denk <wd@denx.de>

* Fix SDRAM timings for LITE5200 / IceCube board

* Handle Auti-MDIX / connection status for INCA-IP

* Fix USB problems when attempting to read 0 bytes

# 80885a9d 26-Feb-2004 Wolfgang Denk <wd@denx.de>

* Patch by Markus Pietrek, 24 Feb 2004:
NS9750 DevBoard added

* Patch by Pierre AUBERT, 24 Feb 2004
add USB support for MPC5200

* Patch by Steven Scholz, 24 Feb 2004:
- fix MII commands to use values from last command

* Patch by Torsten Demke, 24 Feb 2004:
Add support for the eXalion platform (SPSW-8240, F-30, F-300)

# f54ebdfa 17-Sep-2003 Wolfgang Denk <wd@denx.de>

Add auto-update code for TRAB board using USB memory sticks

# a43278a4 11-Sep-2003 Wolfgang Denk <wd@denx.de>

* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices

* Patch by Denis Peter, 11 Sep 2003:
- fix USB data pointer assignment for bulk only transfer.
- prevent to display erased directories in FAT filesystem.

* Change output format for NAND flash - make it look like for other
memory, too

# 149dded2 10-Sep-2003 Wolfgang Denk <wd@denx.de>

* Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD

# 8bde7f77 27-Jun-2003 Wolfgang Denk <wd@denx.de>

* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)

# affae2bf 17-Aug-2002 Wolfgang Denk <wd@denx.de>

Initial revision

# 0cf207ec 27-Sep-2021 Wolfgang Denk <wd@denx.de>

WS cleanup: remove SPACE(s) followed by TAB

Signed-off-by: Wolfgang Denk <wd@denx.de>

# bc0b99bd 06-Jan-2021 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2021.04

arm64:
- DT updates

microblaze:
- Add support for NOR device support

spi:
- Fix unaligned data write issue

nand:
- Minor code change

xilinx:
- Fru fix in limit calculation
- Fill git repo link for all Xilinx boards

video:
- Add support for seps525 spi display

tools:
- Minor Vitis file support

cmd/common
- Minor code indentation fixes

serial:
- Uartlite debug uart initialization fix


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>

# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]

# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>

# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>

# d0851c89 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dee37fc9 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

typedef unsigned int u32;
typedef unsigned long uintptr_t;
typedef unsigned long long u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly. You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 72ac8f3f 27-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# ea7fad91 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled

When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 6158d0b4 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Refactor to use max_xfer_blk from struct us_data

This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# b9560ad6 14-Jun-2017 Simon Glass <sjg@chromium.org>

dm: scsi: Drop the ccb typedef

We should not be using typedefs in U-Boot and 'ccb' is a pretty short
name. It is also used with variables. Drop the typedef and use 'struct'
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8850c5d5 12-May-2017 Tom Rini <trini@konsulko.com>

Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1e5eca7d 10-Apr-2017 Troy Kisky <troy.kisky@boundarydevices.com>

usb: return 0 from usb_stor_get_info even if removable media

This fixes a regression caused by

commit 07b2b78ce4bc8ae25e066c65245eaf58c0d9a67c
dm: usb: Convert USB storage to use driver-model for block devs

which caused part_init to be called when it was not previously.
Without this patch, the following happens when a USB sd card reader is used.

=> usb start
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1 for devices... 3 USB Device(s) found
scanning usb for storage devices... Device NOT ready
Request Sense returned 02 3A 00
### ERROR ### Please RESET the board ###

This happens because dev_desc->blksz is 0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

# b984700c 21-Dec-2016 Michal Simek <michal.simek@xilinx.com>

usb: storage: Show number of storage devices detected for DM_USB

By enabling DM_USB information about number of storage devices
was lost.
Get this information back simply by printing number of devices detected
via BLK uclass.

For example:
scanning bus 0 for devices... 7 USB Device(s) found
scanning usb for storage devices... 3 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 8319aeb1 06-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9107c973 01-May-2016 Simon Glass <sjg@chromium.org>

dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 57ebf67b 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c0543bf6 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b94fc851 16-Mar-2016 Simon Glass <sjg@chromium.org>

usb: Correct return value in usb_stor_info()

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# a6f70a3d 15-Mar-2016 Vagrant Cascadian <vagrant@debian.org>

Fix spelling of "transferred".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 07b2b78c 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Convert USB storage to use driver-model for block devs

Update this code to support CONFIG_BLK. Each USB storage device can have
one or more block devices as children, each one representing a LUN
(logical unit) of the USB device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 9807c3b7 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Tidy up storage code ready for driver model conversion

Adjust a few things so that the addition of driver-models support involved
adding code rather than also changing it. This makes the patches easier to
review.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c89e79d4 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Avoid exceeding available array size for storage devices

The limit on storage devices is USB_MAX_STOR_DEV but we use one extra
element while probing to see if a device is a storage device. Avoid this,
since it causes memory corruption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>

# bcce53d0 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 3e8bd469 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: part: Rename some partition functions

Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4101f687 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: Drop the block_dev_desc_t typedef

Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# 4ef79099 07-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7c4213f6 07-Dec-2015 Stephen Warren <swarren@nvidia.com>

block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 70caa971 03-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Allow up to 7 storage devices

The current limit of 5 is not enough for the driver model USB tests. Really
we should not have a limit but the driver model code still uses the
usb_dev_desc[] array, which has a limit.

Increasing the limit by 2 should not bother anyone. Adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f5fb78a2 11-Oct-2015 Tom Rini <trini@konsulko.com>

common/usb_storage.c: Clean up usb_storage_probe()

We have the protocol and subclass variables which are used only in
disabled debug code. This code dates back to the initial git import and
seemingly dead code so remove it.

This was detected by Coverity (CID 131117)

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcbe3d15 28-Sep-2015 Simon Glass <sjg@chromium.org>

dm: Rename dev_get_parentdata() to dev_get_parent_priv()

The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

# cf92e05c 02-Sep-2015 Simon Glass <sjg@chromium.org>

Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header

Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# abb59cff 06-Jul-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust the USB_DEVICE() macro naming

In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
We should follow the same convention in U-Boot. Rename the existing
USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
macro from Linux for use in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>

# acf277af 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Convert usb_storage to driver model

Add support for scanning USB storage devices with driver model. This mostly
involves adding a USB device ID for storage devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 91557579 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move storage device scanning into its own function

The usb_stor_scan() function is quite long, so split out the code that scans
each device into its own function. Also, rather than setting up the block
device list once at the start, set it up as each device is scanned. This
makes it possible to use this code from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 7fc2c1ea 16-Apr-2015 Simon Glass <sjg@chromium.org>

Revert "usb_storage : scan all interfaces to find a storage device"

This reverts commit cd749658d5994978579628a6333e5c2a6c8ec632.

The conflicts with this commit are hard for me to figure out. I will re-apply
it later.

# 05108132 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust usb_storage to work with sandbox

With a few tweaks we can compile this code with sandbox and enable testing
of the USB storage layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 84073b6f 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Simply device finding code in usb_storage

The for() loop is not needed since the value is immediately accessible.
Use this instead to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 1d5827a1 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2e17c87e 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move USB storage definitions to usb_defs.h

These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# f6570871 01-Apr-2015 Sergey Temerkhanov <s.temerkhanov@gmail.com>

usb_storage:Fix USB storage capacity detection on 64 bit architectures

This patch fixes USB storage capacity detection breakage on 64-bit systems
which arises due to 'unsigned long' length difference. Old code assumes that
to be 32 bit and breaks because of inappropriate response buffer layout.
Also this fixes a number of build warnings and changes big-endian values
treatment style to be architecture-independent

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>

# cd749658 04-Mar-2015 Franck Jullien <franck.jullien@gmail.com>

usb_storage : scan all interfaces to find a storage device

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>

# 6a559bbe 07-Nov-2014 Soeren Moch <smoch@web.de>

usb_storage: blacklist Enclosure Service Devices

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>

# 4fd074de 15-Oct-2014 Simon Glass <sjg@chromium.org>

usb: Use correct printf() format string for uintptr_t

Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ff8fef56 14-Jun-2013 Sascha Silbe <t-uboot@infra-silbe.de>

Fix block device accesses beyond 2TiB

With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>

# 605bd75a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

USB: Some cleanup prior to USB 3.0 interface addition

Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# ceb4972a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

usb: common: Weed out USB_**_PRINTFs from usb framework

USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

# 0472fbfd 09-Apr-2013 Egbert Eich <eich@suse.com>

part/dev_desc: Add log2 of blocksize to block_dev_desc data struct

log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>

# 8b57e2f0 12-Dec-2012 Vincent Palatin <vpalatin@chromium.org>

usb: properly detect empty mass storage media reader

When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 199adb60 29-Oct-2012 Kim Phillips <kim.phillips@freescale.com>

common/misc: sparse fixes

command.c:44:38: error: bad constant expression
dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
hush.c:2175:20: warning: Using plain integer as NULL pointer
hush.c:2175:34: warning: Using plain integer as NULL pointer
hush.c:2210:41: warning: Using plain integer as NULL pointer
hush.c:2216:45: warning: Using plain integer as NULL pointer
hush.c:2249:25: warning: Using plain integer as NULL pointer
hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
hush.c:3295:34: warning: Using plain integer as NULL pointer
hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
image.c:1282:29: warning: Using plain integer as NULL pointer
image.c:1315:41: warning: Using plain integer as NULL pointer
image.c:1330:25: warning: Using plain integer as NULL pointer
image.c:1706:25: warning: Using plain integer as NULL pointer
main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
usb_storage.c:440:48: warning: Using plain integer as NULL pointer
usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
usb_storage.c:629:55: warning: Using plain integer as NULL pointer
usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
usb_storage.c:675:43: warning: Using plain integer as NULL pointer
usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

note: hush.c's nesting_level deleted because not used.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

# e81e79ed 12-Oct-2012 Gabe Black <gabeblack@chromium.org>

usb: Support the CONFIG_SYS_64BIT_LBA option

usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>

# 93c2582f 25-Sep-2012 Lucas Stach <dev@lynxeye.de>

usb: add support for multiple usb controllers

Allows to initialize more than one USB controller at once.

v2: print message when controller stop fails

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>

# b7006958 30-Jul-2012 Jim Shimer <jamesshimer@motorola.com>

usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

# 3e8581bb 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
- Rebase against the latest u-boot-usb master.
- Replace typedef with #define.
- Use the existing flags struct field instead of adding a new field.
- Remove the setter function.
- Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>

# 4bee5c83 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# cffcc503 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# 1b4bd0e6 09-Jul-2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

usb_storage: fix ehci driver max transfer size

The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage:
Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in
usb_storage as it wrongly assumes that every transfer can use
4096 bytes per qt_buffer. This is wrong if the start address of
the data is not page aligned to 4096 bytes and leads to 'EHCI
timed out on TD' messages because of 'out of buffer pointers'
in ehci_td_buffer function.

The bug appears during load of a fragmented file and
read from or write to an unaligned memory address.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

# f5766139 03-Apr-2012 Puneet Saxena <puneets@nvidia.com>

USB: Align buffers at cacheline

This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>

# 5b84dd67 05-Mar-2012 Mike Frysinger <vapier@gentoo.org>

usb: replace wait_ms() with mdelay()

Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>

# 5dd95cf9 21-Dec-2011 Kyle Moffett <Kyle.D.Moffett@boeing.com>

usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

# 4b210e8b 25-Oct-2011 Marek Vasut <marek.vasut@gmail.com>

GCC4.6: Squash subsequent warnings in usb_storage.c

usb_storage.c: In function ‘us_one_transfer’:
usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_reset’:
usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_comdat’:
usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_transport’:
usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_transport’:
usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Remy Bohmer <linux@bohmer.net>

# 86bd3ff8 25-Oct-2011 Marek Vasut <marek.vasut@gmail.com>

GCC4.6: Squash warning in usb_storage.c

usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>

# f092f15d 04-Oct-2011 Wolfgang Denk <wd@denx.de>

Revert "GCC4.6: Convert various empty macros to inline functions"

This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac.

The commit causes build breakage for a number of boards. This results
from the fact that now the arguments of debug() actually get
referenced (even if there is hope that the compiler will optimize
away the debug() call). The obvious fix to that probem (change the
code to always declare the referenced variables and data structures)
increases the code size, and was this rejected. So it was decided to
revert this commit until a better solution is found.

# 60ce53cf 26-Sep-2011 Marek Vasut <marek.vasut@gmail.com>

GCC4.6: Convert various empty macros to inline functions

Fix the following gcc4.6 problems:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]
asix.c: In function ‘asix_init’:
asix.c:317:6: warning: variable ‘rx_ctl’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_parse_config’:
usb.c:331:17: warning: variable ‘ch’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_port_connect_change’:
usb.c:1123:29: warning: variable ‘portchange’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_configure’:
usb.c:1183:25: warning: variable ‘hubsts’ set but not used
[-Wunused-but-set-variable]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>

# df3fc526 23-May-2011 Matthew McClintock <msm@freescale.com>

disk/part.c: Make features optional

If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>

# 6052cbab 03-Feb-2011 Loïc Minier <loic.minier@linaro.org>

Fix misc spelling errors found by lintian

Signed-off-by: Lo�c Minier <loic.minier@linaro.org>

# 56887e27 24-Mar-2011 Erik Hansen <erik@makarta.com>

Remove unnecessary reset in usb_stor_get_info

The reset request in usb_stor_get_info is causing issues with some usb
sticks. Some of these sticks vendor_id/product_id have been hardcoded to
not reset but better is to remove the reset altogether. It is not needed.

Signed-off-by: Erik Hansen <erik@makarta.com>

# 2ff12285 20-Oct-2010 Mike Frysinger <vapier@gentoo.org>

usb_storage: constify us_direction lookup table

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 99e9ed1f 05-Oct-2010 Ludovic Courtès <ludo@gnu.org>

usb: Add support for multiple-LUN mass storage devices

This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device. It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>

# 226fa9bb 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: change progress output in debug() message

The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
. <<==== here
29 file.001
29 file.002
29 file.003
29 file.004
29 file.005
29 file.006
29 file.007
29 file.008
29 file.009
29 file.010
29 file.011
29 file.012
29 file.013
29 file.014
29 file.015
29 file.016
. <<==== here
29 file.017
29 file.018
29 file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# a17c548b 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: initialize device type

The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

=> usb part
print_part of 0

Partition Map for USB device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 0 2031616 f8

print_part of 1
## Unknown partition table

print_part of 2
## Unknown partition table

print_part of 3
## Unknown partition table

print_part of 4
## Unknown partition table
=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>

# fac71cc4 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage probe

While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# aaad108b 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage count

Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>

# 127e1084 02-Nov-2009 Mahavir Jain <mjain@marvell.com>

usb: write command for RAW partition.

This patch implements write support to usb device with raw partition.
It will be useful for filesystem write support to usb device from
u-boot in future.

Tested with writing kernel image to raw usb disk & booting with usb
read command into ram.

[Note: run usb part to get info about start sector & number of
sectors on a partition for usb write operation.]

Signed-off-by: Mahavir Jain <mjain@marvell.com>

# 8f8bd565 30-Oct-2009 Tom Rix <Tom.Rix@windriver.com>

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

unsigned char bRefresh
unsigned char bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h. The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>

# 792a09eb 13-May-2009 Detlev Zundel <dzu@denx.de>

Fix e-mail address of Gary Jennejohn.

Signed-off-by: Detlev Zundel <dzu@denx.de>

# 9704f9ca 28-Oct-2008 Abraham, Thomas <t-abraham@ti.com>

USB: Remove LUN number from CDB

The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB.

Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# c7d703f3 01-Jan-2009 Mike Frysinger <vapier@gentoo.org>

usb.h: use standard __LITTLE_ENDIAN from Linux headers

Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# 14e4111c 01-Jan-2009 Bryan Wu <Bryan.Wu@analog.com>

usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb drive

The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4
does not like to be reset, so check for it.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# a0cb3fc3 10-Dec-2008 Michael Trimarchi <trimarchi@gandalf.sssup.it>

USB storage cleanup patch

Cleanup usb storage

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>

# d6e9ee92 12-Aug-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

common: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

# d0ff51ba 14-Jul-2008 Wolfgang Denk <wd@denx.de>

Code cleanup: fix old style assignment ambiguities like "=-" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# c918261c 21-May-2008 Christian Eggers <ceggers@gmx.de>

USB: replace old swap_ with proper endianess conversion macros

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 1aeed8d7 13-Apr-2008 Wolfgang Denk <wd@denx.de>

Coding Style cleanup; update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b9e749e9 26-Mar-2008 Markus Klotzbuecher <mk@denx.de>

USB, Storage: fix a bug introduced in commit
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info
to only print only information on one storage device, but not for
multiple.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# f6b44e0e 24-Mar-2008 Aras Vaichas <arasv@magtech.com.au>

USB Storage, add meaningful return value

This patch changes the "usb storage" command to return success if it
finds a USB storage device, otherwise it returns error.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

# 409ecdc0 18-Nov-2007 Wolfgang Denk <wd@denx.de>

Fix compiler warnings for PPC systems. Update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 90253178 10-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/: Remove lingering references to CFG_CMD_* symbols.

Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# c3517f91 08-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDS

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# b453960d 11-Jun-2007 Jon Loeliger <jdl@jdl.com>

common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).

This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>

# eb867a76 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers

Block device read/write is anonymous data; there is no need to use a
typed pointer. void * is fine. Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 735dd97b 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 1_4] Merge common get_dev() routines for block devices

Each of the filesystem drivers duplicate the get_dev routine. This change
merges them into a single function in part.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

# 73652699 19-Oct-2006 Wolfgang Denk <wd@pollux.denx.de>

Coding style cleanup

# ddde6b7c 22-Aug-2006 Bartlomiej Sieka <tur@semihalf.com>

Add a fix for a buggy USB device on the FO300 board.

# f88a0ae6 13-Jul-2006 Bartlomiej Sieka <tur@semihalf.com>

Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.

# 77ddac94 13-Oct-2005 Wolfgang Denk <wd@pollux.denx.de>

Cleanup for GCC-4.x

# 460c322f 03-Aug-2005 Wolfgang Denk <wd@pollux.denx.de>

(re)enabled scsi commands do_scsi() and do_scsiboot()
Patch by Denis Peter, 06 Dec 2004

# 095b8a37 02-Aug-2005 Wolfgang Denk <wd@pollux.(none)>

Coding style cleanup

# 9c998aa8 21-Jul-2005 Wolfgang Denk <wd@castor.denx.de>

Fix low-level OHCI transfers for ARM920t and MPC5xxx

A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.

# 2729af9d 03-May-2004 Wolfgang Denk <wdenk>

* Fix minor NAND JFFS2 related issue

* Fixes for SL811 USB controller:
- implement workaround for broken memory stick
- improve error handling

* Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better
cope with congested networks.

# f8d813e3 02-Mar-2004 Wolfgang Denk <wdenk>

* Fix SDRAM timings for LITE5200 / IceCube board

* Handle Auti-MDIX / connection status for INCA-IP

* Fix USB problems when attempting to read 0 bytes

# 80885a9d 26-Feb-2004 Wolfgang Denk <wdenk>

* Patch by Markus Pietrek, 24 Feb 2004:
NS9750 DevBoard added

* Patch by Pierre AUBERT, 24 Feb 2004
add USB support for MPC5200

* Patch by Steven Scholz, 24 Feb 2004:
- fix MII commands to use values from last command

* Patch by Torsten Demke, 24 Feb 2004:
Add support for the eXalion platform (SPSW-8240, F-30, F-300)

# f54ebdfa 17-Sep-2003 Wolfgang Denk <wdenk>

Add auto-update code for TRAB board using USB memory sticks

# a43278a4 11-Sep-2003 Wolfgang Denk <wdenk>

* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices

* Patch by Denis Peter, 11 Sep 2003:
- fix USB data pointer assignment for bulk only transfer.
- prevent to display erased directories in FAT filesystem.

* Change output format for NAND flash - make it look like for other
memory, too

# 149dded2 10-Sep-2003 Wolfgang Denk <wdenk>

* Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD

# 8bde7f77 27-Jun-2003 Wolfgang Denk <wdenk>

* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)

# affae2bf 17-Aug-2002 Wolfgang Denk <wdenk>

Initial revision

# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d91a652c 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

common: usb_storage: Fix code indentation

Reported by smatch like:
common/usb_storage.c:430 us_one_transfer() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# c69cda25 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename dev_get_platdata() to dev_get_plat()

Rename this to be consistent with the change from 'platdata'.

Signed-off-by: Simon Glass <sjg@chromium.org>


# caa4daa2 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename 'platdata' variables to just 'plat'

We use 'priv' for private data but often use 'platdata' for platform data.
We can't really use 'pdata' since that is ambiguous (it could mean private
or platform data).

Rename some of the latter variables to end with 'plat' for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e6f6f9e6 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop part.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 31232de0 06-Apr-2020 Marek Vasut <marek.vasut@gmail.com>

usb: Keep async schedule running only across mass storage xfers

Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.

Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.

Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.

This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# da3d1c49 05-Oct-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Only clear READY flag on error

Clear the USB_READY flag in the storage driver only in case there
is an error, otherwise usb_stor_BBB_transport() waits 5 mS before
doing anything every single time.

This is because the USB_READY flag is only ever set in
usb_test_unit_ready(), which is called only upon storage device
probe, not between each and every request. However, the device
cannot move out of USB_READY state once it was initialized.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 7d6fd7f0 15-Sep-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

usb: storage: Limit transfer size to 120 kiB

Due to constant influx of more and more weird and broken USB sticks,
do as Linux does in commit 779b457f66e10de3471479373463b27fd308dc85

usb: storage: scsiglue: further describe our 240 sector limit

Just so we have some sort of documentation as to why
we limit our Mass Storage transfers to 240 sectors,
let's update the comment to make clearer that
devices were found that would choke with larger
transfers.

While at that, also make sure to clarify that other
operating systems have similar, albeit different,
limits on mass storage transfers.

And reduce the maximum transfer length of USB storage to 120 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# 3437121c 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: Add nonblock argument to submit_int_msg

This will be used to implement non-blocking keyboard polling in case of
errors.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 50dce8fb 18-Aug-2019 Michal Suchanek <msuchanek@suse.de>

usb: storage: submit_int_msg -> usb_int_msg

Use the wrapper as other callers do.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>


# 1af9bfd3 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: storage: s/CONFIG_BLK/CONFIG_IS_ENABLED(BLK)/

This fixes link issues when building the SPL without USB driver model
but with USB storage support. CONFIG_BLK can be enabled and disabled
independently for SPL and non-SPL builds. We leverage that existing
functionality here.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# fd09c205 21-Nov-2018 Sven Schwermer <sven@svenschwermer.de>

usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/

This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>


# d0851c89 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# dee37fc9 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove <inttypes.h> includes and PRI* usages in printf() entirely

In int-ll64.h, we always use the following typedefs:

typedef unsigned int u32;
typedef unsigned long uintptr_t;
typedef unsigned long long u64;

This does not need to match to the compiler's <inttypes.h>.
Do not include it.

The use of PRI* makes the code super-ugly. You can simply use
"l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 72ac8f3f 27-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()

The stored 'blk' value is overwritten to 'size / 512' before it can
be used in usb_stor_set_max_xfer_blk(). This is not what we want.
In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we
should simply assign 'size' to the upper limit.

Reported-by: Coverity (CID: 167250)
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>


# ea7fad91 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

dm: usb: storage: Fix broken read/write when both EHCD and xHCD are enabled

When EHCD and xHCD are enabled at the same time, USB storage device
driver will fail to read/write from/to the storage device attached
to the xHCI interface, due to its transfer blocks exceeds the xHCD
driver limitation.

With driver model, we have an API to get the controller's maximum
transfer size and we can use that to determine the storage driver's
capability of read/write.

Note: the non-DM version driver is still broken with xHCD and the
intent here is not to fix the non-DM one, since the xHCD itself is
already broken in places like 3.0 hub support, etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>


# 6158d0b4 07-Sep-2017 Bin Meng <bmeng.cn@gmail.com>

usb: storage: Refactor to use max_xfer_blk from struct us_data

This adds a new memeber max_xfer_blk in struct us_data to record
the maximum number of transfer blocks for the storage device.

It is set per HCD setting, and so far is to 65535 for EHCD and 20
for everything else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>


# b9560ad6 14-Jun-2017 Simon Glass <sjg@chromium.org>

dm: scsi: Drop the ccb typedef

We should not be using typedefs in U-Boot and 'ccb' is a pretty short
name. It is also used with variables. Drop the typedef and use 'struct'
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 8850c5d5 12-May-2017 Tom Rini <trini@konsulko.com>

Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>


# 1e5eca7d 10-Apr-2017 Troy Kisky <troy.kisky@boundarydevices.com>

usb: return 0 from usb_stor_get_info even if removable media

This fixes a regression caused by

commit 07b2b78ce4bc8ae25e066c65245eaf58c0d9a67c
dm: usb: Convert USB storage to use driver-model for block devs

which caused part_init to be called when it was not previously.
Without this patch, the following happens when a USB sd card reader is used.

=> usb start
starting USB...
USB0: Port not available.
USB1: USB EHCI 1.00
scanning bus 1 for devices... 3 USB Device(s) found
scanning usb for storage devices... Device NOT ready
Request Sense returned 02 3A 00
### ERROR ### Please RESET the board ###

This happens because dev_desc->blksz is 0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>


# b984700c 21-Dec-2016 Michal Simek <michal.simek@xilinx.com>

usb: storage: Show number of storage devices detected for DM_USB

By enabling DM_USB information about number of storage devices
was lost.
Get this information back simply by printing number of devices detected
via BLK uclass.

For example:
scanning bus 0 for devices... 7 USB Device(s) found
scanning usb for storage devices... 3 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# 8319aeb1 06-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

usb: squash lines for immediate return

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 9107c973 01-May-2016 Simon Glass <sjg@chromium.org>

dm: blk: Add a easier way to create a named block device

Add a function that automatically builds the device name given the parent
and a supplied string. Most callers will want to do this, so putting this
functionality in one place makes more sense.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 57ebf67b 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Drop the get_dev() function

This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c0543bf6 01-May-2016 Simon Glass <sjg@chromium.org>

dm: usb: Add a legacy block interface for USB storage

Add a legacy block interface for USB storage.

Signed-off-by: Simon Glass <sjg@chromium.org>


# b94fc851 16-Mar-2016 Simon Glass <sjg@chromium.org>

usb: Correct return value in usb_stor_info()

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>


# a6f70a3d 15-Mar-2016 Vagrant Cascadian <vagrant@debian.org>

Fix spelling of "transferred".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>


# 07b2b78c 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Convert USB storage to use driver-model for block devs

Update this code to support CONFIG_BLK. Each USB storage device can have
one or more block devices as children, each one representing a LUN
(logical unit) of the USB device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>


# 9807c3b7 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Tidy up storage code ready for driver model conversion

Adjust a few things so that the addition of driver-models support involved
adding code rather than also changing it. This makes the patches easier to
review.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>


# c89e79d4 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: usb: Avoid exceeding available array size for storage devices

The limit on storage devices is USB_MAX_STOR_DEV but we use one extra
element while probing to see if a device is a storage device. Avoid this,
since it causes memory corruption.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>


# bcce53d0 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: block: Rename device number member dev to devnum

This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>


# 3e8bd469 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: part: Rename some partition functions

Rename three partition functions so that they start with part_. This makes
it clear what they relate to.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>


# 4101f687 29-Feb-2016 Simon Glass <sjg@chromium.org>

dm: Drop the block_dev_desc_t typedef

Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>


# 4ef79099 07-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Define USB_MAX_STOR_DEV in only one place

We can define this in the header file and use it in usb_storage.c. There is
no need to define it twice. Remove the #define from usb_storage.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>


# 7c4213f6 07-Dec-2015 Stephen Warren <swarren@nvidia.com>

block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>


# 70caa971 03-Jan-2016 Simon Glass <sjg@chromium.org>

usb: Allow up to 7 storage devices

The current limit of 5 is not enough for the driver model USB tests. Really
we should not have a limit but the driver model code still uses the
usb_dev_desc[] array, which has a limit.

Increasing the limit by 2 should not bother anyone. Adjust it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>


# f5fb78a2 11-Oct-2015 Tom Rini <trini@konsulko.com>

common/usb_storage.c: Clean up usb_storage_probe()

We have the protocol and subclass variables which are used only in
disabled debug code. This code dates back to the initial git import and
seemingly dead code so remove it.

This was detected by Coverity (CID 131117)

Signed-off-by: Tom Rini <trini@konsulko.com>


# bcbe3d15 28-Sep-2015 Simon Glass <sjg@chromium.org>

dm: Rename dev_get_parentdata() to dev_get_parent_priv()

The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>


# cf92e05c 02-Sep-2015 Simon Glass <sjg@chromium.org>

Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header

Now that we have a new header file for cache-aligned allocation, we should
move the stack-based allocation macro there also.

Signed-off-by: Simon Glass <sjg@chromium.org>


# abb59cff 06-Jul-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust the USB_DEVICE() macro naming

In Linux USB_DEVICE() is used to declare a USB device by vendor/device ID.
We should follow the same convention in U-Boot. Rename the existing
USB_DEVICE() macro to U_BOOT_USB_DEVICE() and bring in the USB_DEVICE()
macro from Linux for use in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>


# acf277af 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Convert usb_storage to driver model

Add support for scanning USB storage devices with driver model. This mostly
involves adding a USB device ID for storage devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>


# 91557579 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move storage device scanning into its own function

The usb_stor_scan() function is quite long, so split out the code that scans
each device into its own function. Also, rather than setting up the block
device list once at the start, set it up as each device is scanned. This
makes it possible to use this code from driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>


# 7fc2c1ea 16-Apr-2015 Simon Glass <sjg@chromium.org>

Revert "usb_storage : scan all interfaces to find a storage device"

This reverts commit cd749658d5994978579628a6333e5c2a6c8ec632.

The conflicts with this commit are hard for me to figure out. I will re-apply
it later.


# 05108132 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Adjust usb_storage to work with sandbox

With a few tweaks we can compile this code with sandbox and enable testing
of the USB storage layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>


# 84073b6f 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Simply device finding code in usb_storage

The for() loop is not needed since the value is immediately accessible.
Use this instead to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>


# 1d5827a1 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Fix type problems in usb_stor_get_info()

This function assumes that unsigned long is 32-bits wide, but it is not
on 64-bit machines. Use the correct type, and add a few debug() lines also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>


# 2e17c87e 25-Mar-2015 Simon Glass <sjg@chromium.org>

dm: usb: Move USB storage definitions to usb_defs.h

These are better off in a header file so they can be used by other code (e.g.
the sandbox USB storage emulator).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>


# f6570871 01-Apr-2015 Sergey Temerkhanov <s.temerkhanov@gmail.com>

usb_storage:Fix USB storage capacity detection on 64 bit architectures

This patch fixes USB storage capacity detection breakage on 64-bit systems
which arises due to 'unsigned long' length difference. Old code assumes that
to be 32 bit and breaks because of inappropriate response buffer layout.
Also this fixes a number of build warnings and changes big-endian values
treatment style to be architecture-independent

Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>


# cd749658 04-Mar-2015 Franck Jullien <franck.jullien@gmail.com>

usb_storage : scan all interfaces to find a storage device

Mass storage is not necessary present on interface 0. This
patch allow usb_stor_scan to look in every available interface.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>


# 6a559bbe 07-Nov-2014 Soeren Moch <smoch@web.de>

usb_storage: blacklist Enclosure Service Devices

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>


# 4fd074de 15-Oct-2014 Simon Glass <sjg@chromium.org>

usb: Use correct printf() format string for uintptr_t

Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>


# ff8fef56 14-Jun-2013 Sascha Silbe <t-uboot@infra-silbe.de>

Fix block device accesses beyond 2TiB

With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>


# 605bd75a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

USB: Some cleanup prior to USB 3.0 interface addition

Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>


# ceb4972a 12-Apr-2013 Vivek Gautam <gautam.vivek@samsung.com>

usb: common: Weed out USB_**_PRINTFs from usb framework

USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>


# 0472fbfd 09-Apr-2013 Egbert Eich <eich@suse.com>

part/dev_desc: Add log2 of blocksize to block_dev_desc data struct

log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>


# 8b57e2f0 12-Dec-2012 Vincent Palatin <vpalatin@chromium.org>

usb: properly detect empty mass storage media reader

When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>


# 199adb60 29-Oct-2012 Kim Phillips <kim.phillips@freescale.com>

common/misc: sparse fixes

command.c:44:38: error: bad constant expression
dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer
dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer
dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer
dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer
dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer
dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer
dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer
dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer
dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer
dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer
hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static?
hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static?
hush.c:2175:20: warning: Using plain integer as NULL pointer
hush.c:2175:34: warning: Using plain integer as NULL pointer
hush.c:2210:41: warning: Using plain integer as NULL pointer
hush.c:2216:45: warning: Using plain integer as NULL pointer
hush.c:2249:25: warning: Using plain integer as NULL pointer
hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static?
hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static?
hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static?
hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static?
hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static?
hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static?
hush.c:3295:34: warning: Using plain integer as NULL pointer
hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static
image.c:1282:29: warning: Using plain integer as NULL pointer
image.c:1315:41: warning: Using plain integer as NULL pointer
image.c:1330:25: warning: Using plain integer as NULL pointer
image.c:1706:25: warning: Using plain integer as NULL pointer
main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static?
main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static?
main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static?
usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static?
usb_storage.c:440:48: warning: Using plain integer as NULL pointer
usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static?
usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static?
usb_storage.c:629:55: warning: Using plain integer as NULL pointer
usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static?
usb_storage.c:675:43: warning: Using plain integer as NULL pointer
usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static?
usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static?
usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh
xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static?
xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static?
xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat

note: hush.c's nesting_level deleted because not used.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>


# e81e79ed 12-Oct-2012 Gabe Black <gabeblack@chromium.org>

usb: Support the CONFIG_SYS_64BIT_LBA option

usb_storage wouldn't compile when the CONFIG_SYS_64BIT_LBA option is
turned on because the used fixed size data types in their exported
functions when they should have used lbaint_t for the block count
parameter. That meant that when the sizes happened to be the same, when
using a 28 bit LBA, the driver would build, but when it wasn't, a 48 bit
LBA, things broke.

This change adjusts the signatures to use the right type and makes small
adjustments in the affected functions.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>


# 93c2582f 25-Sep-2012 Lucas Stach <dev@lynxeye.de>

usb: add support for multiple usb controllers

Allows to initialize more than one USB controller at once.

v2: print message when controller stop fails

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>


# b7006958 30-Jul-2012 Jim Shimer <jamesshimer@motorola.com>

usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>


# 3e8581bb 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
- Rebase against the latest u-boot-usb master.
- Replace typedef with #define.
- Use the existing flags struct field instead of adding a new field.
- Remove the setter function.
- Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>


# 4bee5c83 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>


# cffcc503 10-Aug-2012 Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>


# 1b4bd0e6 09-Jul-2012 Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>

usb_storage: fix ehci driver max transfer size

The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage:
Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in
usb_storage as it wrongly assumes that every transfer can use
4096 bytes per qt_buffer. This is wrong if the start address of
the data is not page aligned to 4096 bytes and leads to 'EHCI
timed out on TD' messages because of 'out of buffer pointers'
in ehci_td_buffer function.

The bug appears during load of a fragmented file and
read from or write to an unaligned memory address.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>


# f5766139 03-Apr-2012 Puneet Saxena <puneets@nvidia.com>

USB: Align buffers at cacheline

This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>


# 5b84dd67 05-Mar-2012 Mike Frysinger <vapier@gentoo.org>

usb: replace wait_ms() with mdelay()

Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>


# 5dd95cf9 21-Dec-2011 Kyle Moffett <Kyle.D.Moffett@boeing.com>

usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM

When performing large bulk reads from a CD or DVD using the U-Boot
usb_storage driver, it generates requests of up to 20 blocks at a time.

With a standard 512-byte block size, that is 10240 bytes and within the
limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page).

Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a
maximum transfer size of 40960 bytes, which does not fit.

Since the EHCI specification is impossibly obtuse and far beyond my
comprehension, I chose to dynamically compute the limit based on the
blocksize.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>


# 4b210e8b 25-Oct-2011 Marek Vasut <marek.vasut@gmail.com>

GCC4.6: Squash subsequent warnings in usb_storage.c

usb_storage.c: In function ‘us_one_transfer’:
usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_reset’:
usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_comdat’:
usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_BBB_transport’:
usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c: In function ‘usb_stor_CB_transport’:
usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned
int’, but argument 2 has type ‘long unsigned int’ [-Wformat]
usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘long unsigned int’ [-Wformat]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Remy Bohmer <linux@bohmer.net>


# 86bd3ff8 25-Oct-2011 Marek Vasut <marek.vasut@gmail.com>

GCC4.6: Squash warning in usb_storage.c

usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>


# f092f15d 04-Oct-2011 Wolfgang Denk <wd@denx.de>

Revert "GCC4.6: Convert various empty macros to inline functions"

This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac.

The commit causes build breakage for a number of boards. This results
from the fact that now the arguments of debug() actually get
referenced (even if there is hope that the compiler will optimize
away the debug() call). The obvious fix to that probem (change the
code to always declare the referenced variables and data structures)
increases the code size, and was this rejected. So it was decided to
revert this commit until a better solution is found.


# 60ce53cf 26-Sep-2011 Marek Vasut <marek.vasut@gmail.com>

GCC4.6: Convert various empty macros to inline functions

Fix the following gcc4.6 problems:

cmd_date.c: In function ‘do_date’:
cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used
[-Wunused-but-set-variable]
asix.c: In function ‘asix_init’:
asix.c:317:6: warning: variable ‘rx_ctl’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_parse_config’:
usb.c:331:17: warning: variable ‘ch’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_port_connect_change’:
usb.c:1123:29: warning: variable ‘portchange’ set but not used
[-Wunused-but-set-variable]
usb.c: In function ‘usb_hub_configure’:
usb.c:1183:25: warning: variable ‘hubsts’ set but not used
[-Wunused-but-set-variable]
usb_storage.c: In function ‘usb_stor_CB_reset’:
usb_storage.c:466:6: warning: variable ‘result’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>


# df3fc526 23-May-2011 Matthew McClintock <msm@freescale.com>

disk/part.c: Make features optional

If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>


# 6052cbab 03-Feb-2011 Loïc Minier <loic.minier@linaro.org>

Fix misc spelling errors found by lintian

Signed-off-by: Lo�c Minier <loic.minier@linaro.org>


# 56887e27 24-Mar-2011 Erik Hansen <erik@makarta.com>

Remove unnecessary reset in usb_stor_get_info

The reset request in usb_stor_get_info is causing issues with some usb
sticks. Some of these sticks vendor_id/product_id have been hardcoded to
not reset but better is to remove the reset altogether. It is not needed.

Signed-off-by: Erik Hansen <erik@makarta.com>


# 2ff12285 20-Oct-2010 Mike Frysinger <vapier@gentoo.org>

usb_storage: constify us_direction lookup table

Signed-off-by: Mike Frysinger <vapier@gentoo.org>


# 99e9ed1f 05-Oct-2010 Ludovic Courtès <ludo@gnu.org>

usb: Add support for multiple-LUN mass storage devices

This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device. It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>


# 226fa9bb 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: change progress output in debug() message

The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
. <<==== here
29 file.001
29 file.002
29 file.003
29 file.004
29 file.005
29 file.006
29 file.007
29 file.008
29 file.009
29 file.010
29 file.011
29 file.012
29 file.013
29 file.014
29 file.015
29 file.016
. <<==== here
29 file.017
29 file.018
29 file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>


# a17c548b 19-Jul-2010 Wolfgang Denk <wd@denx.de>

usb_storage.c: initialize device type

The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

=> usb part
print_part of 0

Partition Map for USB device 0 -- Partition Type: DOS

Partition Start Sector Num Sectors Type
1 0 2031616 f8

print_part of 1
## Unknown partition table

print_part of 2
## Unknown partition table

print_part of 3
## Unknown partition table

print_part of 4
## Unknown partition table
=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>


# fac71cc4 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage probe

While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>


# aaad108b 12-Mar-2010 Kim B. Heino <Kim.Heino@bluegiga.com>

USB storage count

Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>


# 127e1084 02-Nov-2009 Mahavir Jain <mjain@marvell.com>

usb: write command for RAW partition.

This patch implements write support to usb device with raw partition.
It will be useful for filesystem write support to usb device from
u-boot in future.

Tested with writing kernel image to raw usb disk & booting with usb
read command into ram.

[Note: run usb part to get info about start sector & number of
sectors on a partition for usb write operation.]

Signed-off-by: Mahavir Jain <mjain@marvell.com>


# 8f8bd565 30-Oct-2009 Tom Rix <Tom.Rix@windriver.com>

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

unsigned char bRefresh
unsigned char bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h. The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>


# 792a09eb 13-May-2009 Detlev Zundel <dzu@denx.de>

Fix e-mail address of Gary Jennejohn.

Signed-off-by: Detlev Zundel <dzu@denx.de>


# 9704f9ca 28-Oct-2008 Abraham, Thomas <t-abraham@ti.com>

USB: Remove LUN number from CDB

The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB.

Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>


# c7d703f3 01-Jan-2009 Mike Frysinger <vapier@gentoo.org>

usb.h: use standard __LITTLE_ENDIAN from Linux headers

Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>


# 14e4111c 01-Jan-2009 Bryan Wu <Bryan.Wu@analog.com>

usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb drive

The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4
does not like to be reset, so check for it.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>


# a0cb3fc3 10-Dec-2008 Michael Trimarchi <trimarchi@gandalf.sssup.it>

USB storage cleanup patch

Cleanup usb storage

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Bohmer <linux@bohmer.net>


# d6e9ee92 12-Aug-2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

common: Move conditional compilation to Makefile

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>


# d0ff51ba 14-Jul-2008 Wolfgang Denk <wd@denx.de>

Code cleanup: fix old style assignment ambiguities like "=-" etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>


# c918261c 21-May-2008 Christian Eggers <ceggers@gmx.de>

USB: replace old swap_ with proper endianess conversion macros

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>


# 1aeed8d7 13-Apr-2008 Wolfgang Denk <wd@denx.de>

Coding Style cleanup; update CHANGELOG

Signed-off-by: Wolfgang Denk <wd@denx.de>


# b9e749e9 26-Mar-2008 Markus Klotzbuecher <mk@denx.de>

USB, Storage: fix a bug introduced in commit
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info
to only print only information on one storage device, but not for
multiple.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>


# f6b44e0e 24-Mar-2008 Aras Vaichas <arasv@magtech.com.au>

USB Storage, add meaningful return value

This patch changes the "usb storage" command to return success if it
finds a USB storage device, otherwise it returns error.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>


# 409ecdc0 18-Nov-2007 Wolfgang Denk <wd@denx.de>

Fix compiler warnings for PPC systems. Update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>


# 90253178 10-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/: Remove lingering references to CFG_CMD_* symbols.

Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>


# c3517f91 08-Jul-2007 Jon Loeliger <jdl@freescale.com>

common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDS

Signed-off-by: Jon Loeliger <jdl@freescale.com>


# b453960d 11-Jun-2007 Jon Loeliger <jdl@jdl.com>

common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).

This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
#if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>


# eb867a76 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write buffer pointers

Block device read/write is anonymous data; there is no need to use a
typed pointer. void * is fine. Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# 735dd97b 20-Feb-2007 Grant Likely <grant.likely@secretlab.ca>

[PATCH 1_4] Merge common get_dev() routines for block devices

Each of the filesystem drivers duplicate the get_dev routine. This change
merges them into a single function in part.c

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# 73652699 19-Oct-2006 Wolfgang Denk <wd@pollux.denx.de>

Coding style cleanup


# ddde6b7c 22-Aug-2006 Bartlomiej Sieka <tur@semihalf.com>

Add a fix for a buggy USB device on the FO300 board.


# f88a0ae6 13-Jul-2006 Bartlomiej Sieka <tur@semihalf.com>

Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.


# 77ddac94 13-Oct-2005 Wolfgang Denk <wd@pollux.denx.de>

Cleanup for GCC-4.x


# 460c322f 03-Aug-2005 Wolfgang Denk <wd@pollux.denx.de>

(re)enabled scsi commands do_scsi() and do_scsiboot()
Patch by Denis Peter, 06 Dec 2004


# 095b8a37 02-Aug-2005 Wolfgang Denk <wd@pollux.(none)>

Coding style cleanup


# de1d0a69 01-Aug-2005 Jon Loeliger <jdl@freescale.com>

Fix style issues primarily in 85xx and 83xx boards.
- C++ comments
- Trailing white space
- Indentation not by TAB
- Excessive amount of empty lines
- Trailing empty lines


# 9c998aa8 21-Jul-2005 Wolfgang Denk <wd@castor.denx.de>

Fix low-level OHCI transfers for ARM920t and MPC5xxx

A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.


# 2729af9d 03-May-2004 wdenk <wdenk>

* Fix minor NAND JFFS2 related issue

* Fixes for SL811 USB controller:
- implement workaround for broken memory stick
- improve error handling

* Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better
cope with congested networks.


# f8d813e3 02-Mar-2004 wdenk <wdenk>

* Fix SDRAM timings for LITE5200 / IceCube board

* Handle Auti-MDIX / connection status for INCA-IP

* Fix USB problems when attempting to read 0 bytes


# 80885a9d 26-Feb-2004 wdenk <wdenk>

* Patch by Markus Pietrek, 24 Feb 2004:
NS9750 DevBoard added

* Patch by Pierre AUBERT, 24 Feb 2004
add USB support for MPC5200

* Patch by Steven Scholz, 24 Feb 2004:
- fix MII commands to use values from last command

* Patch by Torsten Demke, 24 Feb 2004:
Add support for the eXalion platform (SPSW-8240, F-30, F-300)


# f54ebdfa 17-Sep-2003 wdenk <wdenk>

Add auto-update code for TRAB board using USB memory sticks


# a43278a4 11-Sep-2003 wdenk <wdenk>

* Patch by Gary Jennejohn, 11 Sep 2003:
- allow for longer timeouts for USB mass storage devices

* Patch by Denis Peter, 11 Sep 2003:
- fix USB data pointer assignment for bulk only transfer.
- prevent to display erased directories in FAT filesystem.

* Change output format for NAND flash - make it look like for other
memory, too


# 149dded2 10-Sep-2003 wdenk <wdenk>

* Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD


# 8bde7f77 27-Jun-2003 wdenk <wdenk>

* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
- split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
- major rework of command structure
(work done mostly by Michal Cendrowski and Joakim Kristiansen)


# affae2bf 17-Aug-2002 wdenk <wdenk>

Initial revision