summaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)Author
2017-10-27usb: host: Move CONFIG_XHCI_FSL to KconfigRan Wang
use Kconfig to select xhci accordingly. Signed-off-by: Ran Wang <ran.wang_1@nxp.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: York Sun <york.sun@nxp.com>
2017-10-15usb: dwc3-uniphier: replace <common.h> with <linux/bitops.h>Masahiro Yamada
Including <common.h> pulls in a lot of bloat. What this driver needs is BIT(), so replace it with <linux/bitops.h> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Marek Vasut <marex@denx.de>
2017-10-10Merge branch 'rmobile' of git://git.denx.de/u-boot-shTom Rini
2017-10-05Merge git://git.denx.de/u-boot-sunxiTom Rini
2017-10-04bug.h: move runtime BUG/WARN macros into <linux/bug.h>Masahiro Yamada
Collect runtime BUG/WARN into a self-contained header <linux/bug.h> to make these macros easier to use. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-04treewide: replace with error() with pr_err()Masahiro Yamada
U-Boot widely uses error() as a bit noisier variant of printf(). This macro causes name conflict with the following line in include/linux/compiler-gcc.h: # define __compiletime_error(message) __attribute__((error(message))) This prevents us from using __compiletime_error(), and makes it difficult to fully sync BUILD_BUG macros with Linux. (Notice Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().) Let's convert error() into now treewide-available pr_err(). Done with the help of Coccinelle, excluing tools/ directory. The semantic patch I used is as follows: // <smpl> @@@@ -error +pr_err (...) // </smpl> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: Re-run Coccinelle] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-04printk: collect printk stuff into <linux/printk.h> with loglevel supportMasahiro Yamada
When we import code from Linux, with regular re-sync planned, we want to use printk() and pr_*(). U-Boot does not support them in a clean way. So, people end up with local macros, or compat headers here and there, then we occasionally see build errors of definition conflicts. We have include/linux/compat.h, but putting all sorts of unrelated things into a single header is just a temporal workaround. Hence this patch, to find the best home for all printk variants. If you want to use printk() and friends, please include <linux/printk.h>. This header is self-contained, and pulls in only a few headers. When I was testing this clean-up, I noticed the image size exceeded its platform limit on some boards. This is because all pr_*() that were previously defined as no-op in include/linux/mtd/mtd.h (unless CONFIG_MTD_DEBUG is set), are now enabled. To make such boards happy, this commit also implements CONFIG_LOGLEVEL. The concept is similar to the kernel parameter "loglevel". (Actually, the Kconfig help message was taken from kernel-paremeter.txt of Linux) Messages with a loglevel smaller than console loglevel will be printed. The difference is the loglevel is build-time determined. To save the image size, lower priority pr_*() are compiled out. I set the default of CONFIG_LOGLEVEL to 6, i.e. pr_notice and higher priority messages are compiled in. I adjusted CONFIG_LOGLEVEL to avoid build error for some boards. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> [trini: Add in SPL_LOGLEVEL that is the same as LOGLEVEL] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-04usb: Drop the EHCI RCar Gen3Marek Vasut
Since we use EHCI generic driver on RCar Gen3 , this driver is useless. Remove it. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Acked-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2017-10-03sunxi: Fix USB_GADGET implicationMaxime Ripard
USB_GADGET will fail to compile if USB_MUSB_GADGET is not defined. Make sure we have that condition right. Fixes: e0ea88042d51 ("sunxi: Imply USB_ETHER") Suggested-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03musb: sunxi: switch to the device modelMaxime Ripard
The device model was implemented so far using a hook that needed to be called from the board support, without DT support and only for the host. Switch to probing both in peripheral and host mode through the DT. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: provide default USB gadget setupMaxime Ripard
All the Allwinner boards use the same manufacturer, VID and PID for the gadgets. Make them the defaults to remove some boilerplate from our defconfigs. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: usb_ether: Move settings to commonMaxime Ripard
The usb_ether gadget duplicates the USB settings for the manufacturer, product ID and vendor ID. Make sure we use the common option so that we can expect a single VID/PID couple for a single device. Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Lukasz Majewski <lukma@denx.de> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: Make g_dnl USB settings commonMaxime Ripard
The g_dnl USB settings for the vendor ID, product ID and manufacturer are actually common settings that can and should be shared by all the gadgets. Make them common by renaming them, and convert all the users. Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Lukasz Majewski <lukma@denx.de> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: usb_ether: Move the interfaces to KconfigMaxime Ripard
We need to select an interface for the usb_ether gadget, and they haven't been converted to Kconfig yet. Add a choice to make sure we have an option selected, and convert all the users. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: Convert USB_ETHER to KconfigMaxime Ripard
The USB Ethernet gadget option has not yet been moved to Kconfig, let's deal with that. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: Move USBNET_HOST_ADDR to KconfigMaxime Ripard
While the USB Ethernet device address is already defined in Kconfig, the host address isn't. Convert it. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: Document USBNET_DEVADDRMaxime Ripard
Add an help about the USBNET_DEVADDR Kconfig option to make it clearer what it's about. Acked-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: Move USBNET_DEVADDR option out of g_dnlMaxime Ripard
The USBNET_DEVADDR has nothing to do with the USB download gadget, but rather with the USB Ethernet gadget. Move it out of the if statement. Acked-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-01usb: dwc3: add UniPhier specific glue layerMasahiro Yamada
Add UniPhier platform specific glue layer to support USB3 Host mode on Synopsys DWC3 IP. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Marek Vasut <marex@denx.de>
2017-10-01usb: xhci: Set 'Average TRB Length' to 8 for control endpointsBin Meng
Update the codes to conform with xHCI spec chapter 6.2.3. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01usb: xhci: Set 'Error Count' to 0 for isoch endpointsBin Meng
Per xHCI spec, 'Error Count' should be set to 0 for isoch endpoints. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01usb: xhci: Program max burst size for endpointBin Meng
The 'Max Burst Size' indicates to the xHC the maximum number of consecutive USB transactions that should be executed per scheduling opportunity. This is a “zero-based” value, where 0 to 15 represents burst sizes of 1 to 16, but at present this is always set to zero. Let's program the required value according to real needs. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01usb: xhci: Honor endpoint's intervalBin Meng
USB endpoint reports the period between consecutive requests to send or receive data as bInverval in its endpoint descriptor. So far this is ignored by xHCI driver and the 'Interval' field in xHC's endpoint context is always programmed to zero which means 1ms for low speed or full speed , or 125us for high speed or super speed. We should honor the interval by getting it from endpoint descriptor. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01usb: xhci: Fix max packet size for full speed device endpoint 0Bin Meng
In xhci_check_maxpacket(), the control endpoint 0 max packet size is wrongly taken from the interface's endpoint descriptor. However the default endpoint 0 does not come with an endpoint descriptor hence is not included in the interface structure. Change to use epmaxpacketin[0] instead. The other bug in this routine is that when setting max packet size to the xHC endpoint 0 context, it does not clear its previous value at all before programming a new one. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01usb: xhci: Add interrupt transfer supportBin Meng
xHCI uses normal TRBs for both bulk and interrupt. This adds the missing interrupt transfer support to xHCI so that devices like USB keyboard that uses interrupt transfer can work. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01usb: xhci: Don't assume LS/FS devices are always behind a HS hubBin Meng
At present xHCI driver assumes LS/FS devices are attached directly to a HS hub. If they are connected to a LS/FS hub, the driver will fail to perform the USB enumeration process on such devices. This is fixed by looking from the device itself all the way up to the HS hub where the TT that serves the device is located. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01dm: usb: emul: Drop usb_emul_reset()Bin Meng
With the root hub unbinding in usb_stop(), there is no need to do a Sandbox-specific reset operation. usb_emul_reset() is no longer used anywhere, drop it. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01dm: usb: Remove no longer needed blk_unbind_all()Bin Meng
With the root hub unbinding in usb_stop(), there is no need to do a blk uclass specific unbind operation. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01dm: usb: Fix broken usb_stop()Bin Meng
At present we only do device_remove() during usb stop. The DM API device_remove() only marks the device state as inactivated, but still keeps its USB topology (eg: parent, children, etc) in the DM device structure. There is no issue if we only start USB subsystem once and never stop it. But a big issue occurs when we do 'usb stop' and 'usb start' multiple times. Strange things may be observed with current implementation, like: - the enumeration may report only 1 mass storage device is detected, but the total number of USB devices is correct. - USB keyboard does not work anymore after a bunch of 'usb reset' even if 'usb tree' shows it is correctly identified. - read/write flash drive via 'fatload usb' may complain "Bad device" In fact, every time when USB host controller starts the enumeration process, it takes random time for each USB port to show up online, hence each USB device may appear in a different order from previous enumeration, and gets assigned to a totally different USB address. As a result, we end up using a stale USB topology in the DM device structure which still reflects the previous enumeration result, and it may create an exact same DM device name like generic_bus_0_dev_7 that is already in the DM device structure. And since the DM device structure is there, there is no device_bind() call to bind driver to the device during current enumeration process, eventually creating an inconsistent software representation of the hardware topology, a non-working USB subsystem. The fix is to clear the unused USB topology in the usb_stop(), by calling device_unbind() on each controller's root hub device, and the unbinding will unbind all of its children automatically. For Sandbox, we need scan the device tree each time when we start the USB stack, in order to re-create the emulated USB devices and bind drivers for them before we actually do the driver probe. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01usb: emul: hub: Report the actual device speed of the emulation deviceBin Meng
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: emul: Expose find_descriptor() as a public APIBin Meng
This can be useful outside of the sandbox usb emulation uclass driver. Expose it as a public API with a proper prefix (usb_emul_). Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01usb: sandbox: Fix emulator device select logic in usb_emul_find_devnum()Bin Meng
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: sandbox: Initialize root hub's device speed to high speedBin Meng
At present 'usb tree' shows that the root hub on the Sandbox USB controller is at full speed. But its device descriptor says it's USB 2.0, so let's report it as a high speed device. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-10-01usb: emul: Remove maxpacketsize in usb_emul_setup_device()Bin Meng
This parameter is never used. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-09-27usb: dwc2: Align size of invalidating dcache before starting DMASeung-Woo Kim
During using dwc2 usb gadget, if usb message size is too small, following cache misaligned warning is shown: CACHE: Misaligned operation at range [bfdbcb00, bfdbcb04] Align size of invalidating dcache before starting DMA to remove the warning. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2017-09-27usb: kbd: Set a default polling mechanism for USB keyboardBin Meng
The choice of "USB keyboard polling" cannot be optional as without one mechanism being set, it just doesn't work. Set the default one to CONFIG_SYS_USB_EVENT_POLL. Fixes: ecad7051 ("configs: Migrate all of the existing USB symbols, except fastboot") Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-09-27usb: host: ehci-generic: convert to livetreePhilipp Tomsich
Update the generic EHCI driver to support a live tree. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-09-27usb: dwc2: convert to livetreePhilipp Tomsich
Update the DWC2 USB driver to support a live tree. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-09-27rockchip: xhci: Convert to livetreePhilipp Tomsich
Update the Rockchip xhci wrapper driver to support a live device tree. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-09-27dm: usb: ehci: Implement get_max_xfer_size() operationBin Meng
EHCD can handle any transfer length as long as there is enough free heap space left, hence set the theoretical max number SIZE_MAX. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-09-27dm: usb: xhci: Implement get_max_xfer_size() operationBin Meng
xHCD allocates one segment which includes 64 TRBs for each endpoint and the last TRB in this segment is configured as a link TRB to form a TRB ring. Each TRB can transfer up to 64K bytes, however data buffers referenced by transfer TRBs shall not span 64KB boundaries. Hence the maximum number of TRBs we can use in one transfer is 62. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-09-27dm: usb: Add a new USB controller operation 'get_max_xfer_size'Bin Meng
The HCD may have limitation on the maximum bytes to be transferred in a USB transfer. USB class driver needs to be aware of this. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-09-27usb: xhci: Set number of event segments and entries to 1Marek Vasut
The Linux kernel driver sets the number of event segments and entries to 1 , while the initial import of the xhci code set that values to 3 for reasons unknown. While most controllers are fine with more event segments with more entries, there are standard-conformant controllers (ie. Renesas RCar xHCI) which only support 1 event segment. Set the number of event segments and event entries back to 1 to allow such controllers to work with U-Boot xHCI stack. Note that the Renesas controller correctly indicates ERST Max = 1 in HCSPARAMS2[7:4] . Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bin Meng <bmeng.cn@gmail.com>
2017-09-22usb: dwc3: Add dwc3 glue driver support for STiPatrice Chotard
This patch adds the ST glue logic to manage the DWC3 HC on STiH407 SoC family. It configures the internal glue logic and syscfg registers. Part of this code been extracted from kernel.org driver (drivers/usb/dwc3/dwc3-st.c) Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-08usb: net: migrate USB Ethernet adapters to KconfigChris Packham
This migrates ASIX, ASIX88179, MCS7830, RTL8152 and SMSC95XX to Kconfig. Update defconfigs. Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-08usb: net: migrate CONFIG_USB_HOST_ETHER to KconfigChris Packham
CONFIG_USB_HOST_ETHER is the framework that the drivers are dependent on USB_HOST_ETHER. Use this as a menu and move the existing LAN75XX and LAN78XX options under new menu. Finally update the defconfigs that need CONFIG_USB_HOST_ETHER. Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-05usb: gadget: g_dnl: Sync internal SN variable with envSam Protsenko
Since commit 842778a09104 ("usb: gadget: g_dnl: only set iSerialNumber if we have a serial#") "fastboot devices" stopped to show correct device serial number for TI boards, showing this line instead: ???????????? fastboot This is because serial# env variable could be set after g_dnl gadget was initialized (e.g. by using env_set() in the board file). To fix this, let's update internal serial number variable (g_dnl_serial) when "serial#" env var is changed. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Cc: Felipe Balbi <felipe.balbi@linux.intel.com> Tested-by: Heiko Schocher <hs@denx.de> Acked-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Marek Vasut <marex@denx.de>
2017-09-01Merge git://git.denx.de/u-boot-imxTom Rini
Signed-off-by: Tom Rini <trini@konsulko.com> Conflicts: configs/imx6qdl_icore_mmc_defconfig configs/imx6qdl_icore_rqs_defconfig
2017-08-28usb: dwc3: fix Kconfig dependency to accept host driver in drivers/usb/dwc3Masahiro Yamada
We see the choice of USB_DWC3_HOST / _GADGET in drivers/usb/dwc3/Kconfig, but we can not choose USB_DWC3_HOST unless USB_GADGET is defined. This is strange. Loosen the "depends on" and also move "select USB_GADGET_DUALSPEED" to the correct place. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-08-23spl: add serial download protocol (SDP) supportStefan Agner
Add USB serial download protocol support to SPL. If the SoC started in recovery mode the SPL will immediately switch to SDP and wait for further downloads/commands from the host side. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Reviewed-by: Stefano Babic <sbabic@denx.de> Reviewed-by: Łukasz Majewski <lukma@denx.de>