summaryrefslogtreecommitdiff
path: root/drivers/usb/emul/sandbox_hub.c
AgeCommit message (Collapse)AuthorFilesLines
2020-05-19common: Drop log.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-2/+1
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>
2018-04-27Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTRTom Rini1-2/+0
We have a large number of places where while we historically referenced gd in the code we no longer do, as well as cases where the code added that line "just in case" during development and never dropped it. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-01usb: emul: hub: Report the actual device speed of the emulation deviceBin Meng1-3/+30
At present the usb hub emulator always reports its downstream port speed as full speed. Actually it is high speed for sandbox-flash, and low speed for sandbox-keyb. We can determine the device speed by checking its device descriptor bcdUSB field, and do the proper hub port status report based on that. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01usb: sandbox: Fix emulator device select logic in usb_emul_find_devnum()Bin Meng1-0/+2
Current emulator select logic in usb_emul_find_devnum() is to test the USB address. The USB address of the device being enumerated is initialized to zero at the beginning of the enumeration process in usb_setup_device(). At this point, the saved USB address in the platform data has not been assigned to any valid USB address either. This means: the logic will select an emulator device according to its sequence of declaring order in the device tree. Take test.dts for example, flash-stick@0 will be selected before flash-stick@1. But unfortunately such logic is wrong. In fact USB devices show up in a random order during the enumeration which means usb_emul_find_devnum() may be called on port 3 for keyb@3 before on port 0 for flash-stick@0. To fix this, we introduce a new emulator uclass specific platdata to store the USB device's port number on its parent hub, and update the logic to test the port number instead. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01usb: emul: Remove maxpacketsize in usb_emul_setup_device()Bin Meng1-2/+1
This parameter is never used. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-07-29usb: hub: Change USB hub descriptor to match USB 3.0 hubsBin Meng1-1/+6
USB 3.0 hubs have a slightly different hub descriptor than USB 2.0 hubs, with a fixed (rather than variable length) size. Change the host controller drivers that access those last two fields (DeviceRemovable and PortPowerCtrlMask) to use the union. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de> Tested-by: Stefan Roese <sr@denx.de>
2017-06-01sandbox: usb: Convert emulators to livetreeSimon Glass1-2/+1
Update the sandbox flash and hub USB emulators to support a live device tree. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-04-05dm: core: Add flags parameter to device_remove()Stefan Roese1-1/+1
This patch adds the flags parameter to device_remove() and changes all calls to this function to provide the default value of DM_REMOVE_NORMAL for "normal" device removal. This is in preparation for the driver specific pre-OS (e.g. DMA cancelling) remove support. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
2017-02-08dm: core: Replace of_offset with accessorSimon Glass1-1/+2
At present devices use a simple integer offset to record the device tree node associated with the device. In preparation for supporting a live device tree, which uses a node pointer instead, refactor existing code to access this field through an inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-11-20sandbox: usb: Allow up to 4 emulated devices on a hubSimon Glass1-1/+1
To support more advanced testing, support 4 devices instead of 2. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-22dm: usb: Add a terminator to the string destructor listSimon Glass1-0/+1
The terminator is missing. Add it for completeness. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com> Tested-by: Joe Hershberger <joe.hershberger@ni.com>
2015-04-18dm: usb: sandbox: Add an emulator for USB hub emulationSimon Glass1-0/+303
All USB controllers need a root hub. Add a sandbox emulation for this so that we can add USB devices to sandbox. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>