summaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)Author
2018-06-16Merge branch 'master' of git://git.denx.de/u-boot-usbTom Rini
2018-06-14usb: sunxi: access ahb_reset0_cfg in CCM using its offsetVasily Khoruzhick
struct sunxi_ccm_reg doesn't have ahb_reset0_cfg on sun4i and sun5i, thus compilation fails with: drivers/usb/host/ohci-sunxi.c:96:26: error: 'struct sunxi_ccm_reg' has no member named 'ahb_reset0_cfg' Access this reg using its offset to fix this issue. Fixes commit 1ed9c1118 ("usb: sunxi: ehci: get rid of ifdefs") and commit 56830cee3 ("usb: sunxi: ohci: get rid of ifdefs") Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2018-06-13Merge git://git.denx.de/u-boot-x86Tom Rini
2018-06-13lib: Add hexdumpAlexey Brodkin
Often during debugging session it's very interesting to see what data we were dealing with. For example what we write or read to/from memory or peripherals. This change introduces functions that allow to dump binary data with one simple function invocation like: ------------------->8---------------- print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len); ------------------->8---------------- which gives us the following: ------------------->8---------------- 00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115 00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con 00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520 00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3. 00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage. 00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9 00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr 00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde 00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022 00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial 000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou 000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220 000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00.............. ... ------------------->8---------------- Source of hexdump.c was copied from Linux kernel v4.7-rc2. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Anatolij Gustschin <agust@denx.de> Cc: Mario Six <mario.six@gdsys.cc> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Stefan Roese <sr@denx.de>
2018-06-13usb: sunxi: sun50i: enable OHCI0 clock when OHCI1 is in useVasily Khoruzhick
On A64 OHCI1 clock source is OHCI0 clock, so we need to enable OHCI0 clock when OHCI1 is in use. Fixes commit dd3228170ad7 ("usb: sunxi: Switch to use generic-phy") Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2018-06-13usb: sunxi: ohci: get rid of ifdefsVasily Khoruzhick
We can use compatibles instead. Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2018-06-13usb: sunxi: ehci: get rid of ifdefsVasily Khoruzhick
We can use compatibles instead. Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2018-06-13usb: xhci-pci: Fix compiler warningBin Meng
This fixes the following compiler warning: "warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]" Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-06-07bug.h: introduce WARN_ONCERamon Fried
Add WARN_ONCE definition to allow single time notification of warnings to the user. Taken from Linux kernel (4.17) with slight changes (Removed __section(.data.once)) Signed-off-by: Ramon Fried <ramon.fried@gmail.com> [trini: Drop the musb and dwc3 compat versions] Signed-off-by: Tom Rini <trini@konsulko.com>
2018-06-04Merge branch 'master' of git://git.denx.de/u-boot-sunxiTom Rini
2018-06-01Merge tag 'xilinx-for-v2018.07-2' of git://www.denx.de/git/u-boot-microblazeTom Rini
Xilinx changes for v2018.07 second pull zynqmp: - Show reset reason - Remove emulation platform - Update pmufw version - Simplify mmc bootmode - Remove dc2 useless configuration file - Cleanup mini config - Defconfig syncup - zcu100, zcu104 and zcu111 dts fixes xilinx: - Use live-tree functions in some drivers - Add support for Avnet Minized and Antminer S9 fpga: - Add secure bitstream loading support mmc: - Add hs200 mode support usb xhci: - Header fix
2018-05-31usb: xhci: zynqmp: Fix header locationMichal Simek
There is no reason to specify header with full soc name. Symlink is setup automatically (arch -> arch-zynqmp) Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-05-30usb: fastboot: Convert USB f_fastboot to shared fastbootAlex Kiernan
Convert USB fastboot code to use shared fastboot protocol. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-30fastboot: Rename public fb_ functions to fastboot_Alex Kiernan
Rename fb_mmc_flash_write/fb_mmc_erase/fb_nand_flash_write/fb_nand_erase to fastboot_... as they form a public interface Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-30fastboot: Extract common definitions from USB fastbootAlex Kiernan
Move FASTBOOT_VERSION to include/fastboot.h so when we merge the UDP code we only have one definition. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-05-30fastboot: Rename fb_set_reboot_flag to fastboot_set_reboot_flagAlex Kiernan
Rename fb_set_reboot_flag to fastboot_set_reboot_flag so it matches all other fastboot code in the global name space. Fix the guards around them so that they're dependent on FASTBOOT, not just USB_FUNCTION_FASTBOOT. Move the weak implementation of fastboot_set_reboot_flag to fb_common.c so we can call it from non-USB fastboot code. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-05-30fastboot: Correct dependencies in FASTBOOT_FLASHAlex Kiernan
Ensure that when selecting FASTBOOT_FLASH you end up with a buildable configuration. Prior to this you could select NAND without MTDPARTS and end up with an image which (surprisingly) excluded NAND. Also fix dependencies on FASTBOOT_GPT_NAME/FASTBOOT_MBR_NAME which require you have EFI_PARTITION/DOS_PARTITION enabled. Delete redundant FASTBOOT_FLASH_NAND_DEV from Kconfig - it was only ever used as a guard and the value was ignored in all cases, we're using FASTBOOT_FLASH_NAND as the guard now. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2018-05-30fastboot: Extract fastboot_okay/fail to fb_common.cAlex Kiernan
Add drivers/fastboot/fb_common.c, where fastboot_okay/fail are implemented so we can call them from a non-USB implementation. Introduce fastboot_response which takes varargs parameters so we can use it to generate formatted response strings. Refactor fastboot_okay/fail to use it. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2018-05-30fastboot: Refactor fastboot_okay/fail to take responseAlex Kiernan
Add the response string as a parameter to fastboot_okay/fail, instead of modifying a global, to match the contract expected by the AOSP U-Boot code. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2018-05-30gadget: f_thor: Fix memory leaks of usb request and its bufferSeung-Woo Kim
There are memory leaks of usb request and its buffer for ep0, in_ep, and out ep. Fix memory leaks of usb request and its buffer. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2018-05-30rockchip: xhci: remove DTS parsing for PHY (which is unused)Philipp Tomsich
The xhci wrapper-driver for Rockchip searches the DTS to find its child node compatbile with 'rockchip,rk3399-usb3-phy' to retrieve the base-address of the PHY. However, this is currently broken (and always has been), returning NULL. However, the (wrongly) retrieved base-address is never used. We thus remove this code for now. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-05-30usb: xhci: Handle endianness in xhci_set_configuration()Bin Meng
In xhci_set_configuration(), 'Context Entries' field in the slot context was cleared with mask LAST_CTX_MASK, but it should have taken the endianness into consideration. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2018-05-30usb: xhci: Fix config fail of FS hub behind a HS hub with MTTBin Meng
If a full speed hub connects to a high speed hub which supports MTT, the MTT field of its slot context will be set to 1 when xHCI driver setups an xHCI virtual device in xhci_setup_addressable_virt_dev(). Once usb core fetch its hub descriptor, and need to update the xHC's internal data structures for the device, the HUB field of its slot context will be set to 1 too, meanwhile MTT is also set before, this will cause configure endpoint command fail. In the case, we should clear MTT to 0 for full speed hub according to section 6.2.2. This keeps in sync with Linux kernel commit: 096b110: usb: xhci: fix config fail of FS hub behind a HS hub with MTT Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2018-05-30usb: xhci: Initialize dev_state to 0 in the input slot contextBin Meng
Per xHCI spec chapter 6.2.2 table 6-7, as input, software shall initialize the dev_state field to '0'. Though this does not seem to cause any issue with most xHC implementations, let's do this to conform with the spec. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Marek Vasut <marek.vasut@gmail.com> Tested-by: Matthias Blankertz <matthias.blankertz@cetitec.com>
2018-05-30usb: xhci: Set accurate add context flags when updating hub attributesBin Meng
If a USB 3.0 hub is plugged into the root port of the xHC, the xHCI driver will issue a 'Configure Endpoint' command to the xHC for it to update its internal data structure for this hub device. The hub attributes are in the slot context so we need tell xHC to update the slot context by setting the add context flags of the input control context to only cover the slot context. At present the add context flags is or'ed with the slot context bit, but it should really be accurately set to the slot context, as the variable that holds the value of the add context flags comes from whatever was set in the last command execution, which may contain additional contexts that 'Configure Endpoint' command should not touch. Some xHC implementations like x86 don't complain such, but it was observed on Renesas RCar Gen3 platform that the RCar xHC complains with a 'TRB error' completion codes as the response. Reported-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Marek Vasut <marek.vasut@gmail.com> Tested-by: Matthias Blankertz <matthias.blankertz@cetitec.com>
2018-05-30usb: xhci-rcar: deregister before deactivating clockMatthias Blankertz
During the execution of xhci_deregister xHCI registers are accessed. If the clock is already deactivated when xhci_deregister is called this can lead to undefined behavior. Change the order to deregister the device before deactivating the clock. Signed-off-by: Matthias Blankertz <matthias.blankertz@cetitec.com>
2018-05-28usb: sunxi: Switch to use generic-phyJagan Teki
Allwinner USB PHY handling can be done through driver-model generic-phy so add the generic-phy ops to relevant places on host and musb sunxi driver and enable them in respective SOC's. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Jun Nie <jun.nie@linaro.org>
2018-05-28phy: sun4i-usb: Add a sunxi specific function for setting squelch-detectJagan Teki
The sunxi otg phy has a bug where it wrongly detects a high speed squelch when reset on the root port gets de-asserted with a lo-speed device. The workaround for this is to disable squelch detect before de-asserting reset, and re-enabling it after the reset de-assert is done. Add a sunxi specific phy function to allow the sunxi-musb glue to do this. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Jun Nie <jun.nie@linaro.org>
2018-05-28musb: sunxi: Add support for H3/H5/A64Jagan Teki
Like other Allwinner SoC, the H3/H5/A64 is missing the config register from the musb hardware block. Use a known working value for it like other SoC. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Jun Nie <jun.nie@linaro.org>
2018-05-28musb: sunxi: Use BIT instead of numerical shiftJagan Teki
Use BIT is possible areas instead of numerical shift. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Jun Nie <jun.nie@linaro.org>
2018-05-28musb: sunxi: Add OTG device clkgate and reset for H3/H5Jagan Teki
Add OTG device clkgate and reset for H3/H5 through driver_data. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Jun Nie <jun.nie@linaro.org>
2018-05-28musb: sunxi: Add fifo configJagan Teki
Unlike other Allwinner SOC's H3/H5/V3s OTG support 4 endpoints with relevant fifo configs, rest all have 5 endpoints. So add the fifo configs and defer them based on driver_data. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Jun Nie <jun.nie@linaro.org>
2018-05-28musb: sunxi: Use simple way to fill musb_hdrc pdataJagan Teki
Filling musb_hdrc pdata using structure will unnecessary add extra ifdefs, so fill them inside probe call for better code understanding and get rid ifdefs using devicetree compatible. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Jun Nie <jun.nie@linaro.org>
2018-05-28musb: sunxi: Add proper macros instead of numericalsJagan Teki
- add proper macros for musb_config members - use bool 'true' for multipoint and dyn_fifo instead of numerical 1 Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Jun Nie <jun.nie@linaro.org>
2018-05-28usb: sunxi: Simplify ccm reg base codeJagan Teki
Move struct sunxi_ccm_reg pointer to private structure so-that accessing ccm reg base become more proper way and avoid local initialization in each function. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Jun Nie <jun.nie@linaro.org>
2018-05-18drivers: usb: dwc3: remove devm_zalloc from linux_compactMugunthan V N
devm_zalloc() is already defined in dm/device.h header, so devm_zalloc can be removed from linux_compact.h beader file. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-05-18usb: xhci: zynqmp: Remove support for !DM_USBMichal Simek
Switch to DM_USB was done and there is no need to keep !DM_USB code in tree. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-18usb: xhci: zynqmp: Add support for DM_USBMichal Simek
The patch is adding support for DM_USB for xhci driver. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-05-18usb: dwc3: Add generic DWC3 glue logic driverMichal Simek
By enabling BLK by default this is the next driver which needs to get support for DM_USB. Adding generic DWC3 glue logic which only parse nodes and read device mode. Based on it probe proper host/peripheral DWC3 drivers for it. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-05-18usb: common: add support to get maximum speed from dtMugunthan V N
Add support to get maximum speed from dt so that usb drivers makes use of it for DT parsing. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> (rebase and fix errors) Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-18usb: dwc3: Add dwc3_init/remove with DM_USBMugunthan V N
The patch is preparing dwc3 core for enabling DM_USB with peripheral driver with using driver model support. The driver will be bound by the DWC3 wrapper driver based on the dr_mode device tree entry. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> (Remove dwc3-omap changes) Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-05-18gadget: f_thor: update to support more than 4GB file as thor 5.0Seung-Woo Kim
During file download, it only uses 32bit variable for file size and it limits maximum file size less than 4GB. Update to support more than 4GB file with using two 32bit variables for file size as thor protocol 5.0. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2018-05-18gadget: f_thor: fix filename overflowSeung-Woo Kim
The thor sender can send filename without null character and it is used without consideration of overflow. Actually, character array for filename is assigned with DEFINE_CACHE_ALIGN_BUFFER() and it is bigger than size of memcpy, so there was no real overflow. Fix filename overflow for code level integrity. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2018-05-15usb: composite convert __set_bit to generic_set_bitBryan O'Donoghue
Compiling the f_mass_storage driver for an x86 target results in a compilation error as set_bit and clear_bit are provided by bitops.h To address that situation we discussed on the list moving to genetic_set_bit() instead. Doing a quick grep for similar situations in drivers/usb shows that the composite device is using __set_bit(). This patch switches over to generic_set_bit to maintain consistency between the two gadget drivers. Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie> Cc: Lukasz Majewski <lukma@denx.de> Cc: Marek Vasut <marex@denx.de>
2018-05-15usb: f_mass_storage: Fix set_bit and clear_bit usageBryan O'Donoghue
Compiling the f_mass_storage driver for an x86 target results in a compilation error as set_bit and clear_bit are provided by bitops.h Looking at the provenance of the current u-boot code and the git change history in the kernel, it looks like we have a local copy of set_bit and clear_bit as a hold-over from porting the Linux driver into u-boot. These days __set_bit and __clear_bit are optionally provided by an arch and can be used as inputs to generic_bit_set and generic_bit_clear. This patch switches over to generic_set_bit and generic_clear_bit to accommodate. Tested on i.MX WaRP7 and Intel Edison Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie> Cc: Lukasz Majewski <lukma@denx.de> Cc: Marek Vasut <marex@denx.de>
2018-05-10SPDX: Convert a few files that were missed beforeTom Rini
As part of the main conversion a few files were missed. These files had additional whitespace after the '*' and before the SPDX tag and my previous regex was too strict. This time I did a grep for all SPDX tags and then filtered out anything that matched the correct styles. Fixes: 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style") Reported-by: Heinrich Schuchardt <xypron.debian@gmx.de> Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07regmap: clean up regmap allocationMasahiro Yamada
Putting zero length array at the end of struct is a common technique to embed arbitrary length of members. There is no good reason to let regmap_alloc_count() branch by "if (count <= 1)". As far as I understood the code, regmap->base is an alias of regmap->ranges[0].start, but it is not helpful but make the code just ugly. Rename regmap_alloc_count() to regmap_alloc() because the _count suffix seems pointless. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: fixup cpu_info-rcar.c] Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07SPDX: Convert all of our multiple license tags to Linux Kernel styleTom Rini
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 multiple licenses (in these cases, dual license) declared in the SPDX-License-Identifier tag. In this case we change from listing "LICENSE-A LICENSE-B" or "LICENSE-A or LICENSE-B" or "(LICENSE-A OR LICENSE-B)" to "LICENSE-A OR LICENSE-B" as per the Linux Kernel style document. Note that parenthesis are allowed so when they were used before we continue to use them. Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
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-30usb: f_mass_storage: simplify logical expressionHeinrich Schuchardt
An unsigned int is always >= 0. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>