Commit Graph

1275 Commits

Author SHA1 Message Date
Sriram Dash
e915716a5c drivers: usb: xhci-fsl: Change burst beat and outstanding pipelined transfers requests
This is required for better performance, and performs below tuning:
1. Enable burst length set, and define it as 4/8/16.
2. Set burst request limit to 16 requests.

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
2016-09-27 23:30:16 +02:00
Alban Bedel
cea6c8ce23 net: asix: Fix ASIX 88772B with driver model
Commit 147271209a ("net: asix: fix operation without eeprom")
added a special handling for ASIX 88772B that enable another
type of header. This break the driver in DM mode as the extra handling
needed in the receive path is missing.

However this new header mode is not required and only seems to
increase the code complexity, so this patch revert this part of
commit 147271209a.

This also reverts commit 41d1258ace
("net: asix: Fix AX88772B when used with DriverModel") of late.

Fixes: 147271209a ("net: asix: fix operation without eeprom")

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2016-09-27 23:30:14 +02:00
Tom Rini
40e1236afe Merge branch 'master' of git://git.denx.de/u-boot-tegra 2016-09-27 12:47:25 -04:00
Stephen Warren
2f6a7e8ce5 ARM: tegra: fix USB ULPI PHY reset signal inversion confusion
USB ULPI PHY reset signals are typically active low. Consequently, they
should be marked as GPIO_ACTIVE_LOW in device tree, and indeed they are in
the Linux kernel DTs, and in DT properties that U-Boot doesn't yet use.
However, in DT properties that U-Boot does use, the value has been set to
0 (== GPIO_ACTIVE_HIGH) to work around a bug in U-Boot.

This change fixes the DT to correctly represent the HW, and fixes the
Tegra USB driver to cope with the fact that dm_gpio_set_value() internally
handles any inversions implied by the DT value GPIO_ACTIVE_LOW.

Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-09-27 09:11:03 -07:00
Tom Rini
6d5565608f Merge git://www.denx.de/git/u-boot-marvell 2016-09-27 11:40:56 -04:00
Stefan Roese
d36277ef4f usb: xhci-mvebu: Add Armada 8K to compatiblity list
To enable this driver on Armada 7K/8K this patch adds the compatibility
property to the list.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Neta Zur Hershkovits <neta@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Omri Itach <omrii@marvell.com>
Cc: Igal Liberman <igall@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
2016-09-27 17:29:54 +02:00
Stefan Roese
c6cfcc91ea usb: ehci: ehci-marvell.c: Add Armada 3700 support (ARMv8)
This patch adds DM based support for the Armada 3700 EHCI controller.
The address windows don't need to get configured in this case. The
difference here is detected via DT compatible property at runtime.

With this support and the DM xHCI driver, both XHCI and eHCI can be
used simultaniously on the MVEBU boards now.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Acked-by: Marek Vasut <marex@denx.de>
2016-09-27 17:29:53 +02:00
Stefan Roese
81c1f6f0c3 usb: xhci: Add Marvell MVEBU xHCI support
This patch adds DM based support for the xHCI USB 3.0 controller
integrated in the Armada 3700 SoC. It may be extended to be used
by other MVEBU SoCs as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Victor Gu <xigu@marvell.com>
Cc: Hua Jing <jinghua@marvell.com>
Cc: Terry Zhou <bjzhou@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Acked-by: Marek Vasut <marex@denx.de>
2016-09-27 17:29:52 +02:00
Tom Rini
6ad6102246 usb:gadget: Disallow DFU in SPL for now
Previously, DFU was not built in for SPL and often disabled via the board
config.h file, in the SPL build.  By moving DFU to Kconfig we now need to
move this logic to the Makefile to continue to allow boards to fit within
their SPL size limit (until gcc 6 is more widespread and unused strings will
be discarded).

Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-27 10:46:20 -04:00
Masahiro Yamada
8824cfc19a usb: ehci-generic: support reset control for generic EHCI
This driver is designed in a generic manner, so resets should be
handled generically as well.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-09-23 22:25:44 -04:00
Masahiro Yamada
4982f46420 Move ENOTSUPP defines to include/linux/errno.h
Collect a couple of duplicated defines into a single place.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-09-23 22:25:43 -04:00
Masahiro Yamada
5d97dff042 treewide: replace #include <asm-generic/errno.h> with <linux/errno.h>
Now, include/linux/errno.h is a wrapper of <asm-generic/errno.h>.
Replace all include directives for <asm-generic/errno.h> with
<linux/errno.h>.

<asm-generic/...> is supposed to be included from <asm/...> when
arch-headers fall back into generic implementation. Generally, they
should not be directly included from .c files.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Add drivers/usb/host/xhci-rockchip.c]
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-23 22:25:27 -04:00
Masahiro Yamada
1221ce459d treewide: replace #include <asm/errno.h> with <linux/errno.h>
Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content.  (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-23 17:55:42 -04:00
Masahiro Yamada
8319aeb1da usb: squash lines for immediate return
This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-09-23 17:53:48 -04:00
Masahiro Yamada
4052734273 usb: replace ehci_*_remove() with usb_deregister()
The remove callbacks of EHCI drivers are often just a wrapper of
ehci_deregister.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
2016-09-23 17:53:46 -04:00
Kever Yang
f7bb27a577 usb: host: add Kconfig for USB_XHCI_ROCKCHIP
Add a Kconfig for Rockchip xhci controller.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Marek Vasut <marex@denx.de>
2016-09-22 07:36:58 -06:00
MengDongyang
b44566c4ce usb: xhci-rockchip: add rockchip dwc3 controller driver
This patch add support for rockchip dwc3 controller, which corresponding
to the two type-C port on rk3399 evb.
Only support usb2.0 currently for we have not enable the usb3.0 phy
driver and PD(fusb302) driver.

Signed-off-by: MengDongyang <daniel.meng@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-09-22 07:32:22 -06:00
Tom Rini
9a6535e05f Merge branch 'master' of git://git.denx.de/u-boot-uniphier 2016-09-18 14:05:30 -04:00
Hans de Goede
7c22e26ec5 sunxi: musb: Re-init musb controller on repeated probe calls
With sunxi-musb musb_lowlevel_init() can fail when a charger; or no cable
is plugged into the otg port.

To avoid leaking the struct musb allocated by musb_init_controller()
on repeated musb_usb_probe() calls, we were caching its result.
But musb_init_controller() does more, such as calling sunxi_musb_init()
which enables the clocks.

Not calling sunxi_musb_init() causes the musb controller to stop working
after a "usb reset" since that calls musb_usb_remove() which disables the
clocks.

This commit fixes this by removing the caching of the struct returned
from musb_init_controller(), it replaces this by free-ing the allocated
memory in musb_usb_remove() and calling musb_usb_remove() on
musb_usb_probe() errors to ensure proper cleanup.

While at it also make musb_usb_probe() and musb_usb_remove() static.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-18 14:39:16 +02:00
Chen-Yu Tsai
57075a472a sunxi: musb: Power off OTG port VBUS when disabled
The Linux kernel musb driver expects VBUS to be off while initializing
musb. Having it on results in a repeating string of warnings, followed
by an unusable peripheral. The peripheral is only usable after
physically removing the OTG adapter, letting musb reset its state.

This partially reverts commit c9f8947e66 ("sunxi: usb-phy: Never
power off the usb ports")

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-17 14:37:40 +02:00
Masahiro Yamada
47a79f657e usb: uniphier: remove UniPhier xHCI driver and select DM_USB
This driver has not been converted to Driver Model, and it is an
obstacle to migrate other block device drivers.  Remove it for now.

The UniPhier SoCs already use a DM-based EHCI driver, so now
ARCH_UNIPHIER can select DM_USB.

These two changes must be done atomically because removing the
legacy driver causes a build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2016-09-14 22:54:19 +09:00
Joshua Scott
41d1258ace net: asix: Fix AX88772B when used with DriverModel
A previous patch (net: asix: fix operation without eeprom) added a
two-byte shift to the packet buffer when receiving a packet on the
AX88772B.

This shift was not included when the driver was updated to work with
DriverModel. Testing on a Marvell DB-88F6820-ACM showed that the adapter
was not functioning correctly (EHCI timeouts).

This patch brings the two-byte shift to the DriverModel implementation
of ops->recv (asix_eth_recv).

Testing on the same board, we were able to TFTP a file over and confirm
that the crc32 was correct.

Signed-off-by: Joshua Scott <joshua.scott@alliedtelesis.co.nz>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-09-09 13:13:42 -05:00
Steve Rae
e016f0b2c2 fastboot: implement Kconfig
implement Kconfig for the 'fastboot' feature set

Signed-off-by: Steve Rae <steve.rae@raedomain.com>
2016-08-20 14:03:23 -04:00
Tom Rini
0fcb9f07a1 Merge branch 'master' of git://git.denx.de/u-boot-atmel 2016-08-15 17:31:23 -04:00
Wenyou Yang
17b68b5a58 dm: atmel: Add driver model support for the ehci driver
Add driver model support while retaining the existing legacy code.
This allows the driver to support boards that have converted to
driver model as well as those that have not.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-08-15 22:58:04 +02:00
Chris Packham
70f1463686 net: smsc95xx: Use correct get_unaligned functions
The __get_unaligned_le* functions may not be declared on all platforms.
Instead, get_unaligned_le* should be used. On many platforms both of
these are the same function.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-08-15 13:34:45 -05:00
Alban Bedel
76b2fad775 eth: asix88179: Add support for the driver model
Adjust this driver to support driver model for Ethernet.

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
2016-08-09 12:52:05 +02:00
Alban Bedel
620452e7ae eth: asix88179: Prepare supporting the driver model
Change the prototype of a few functions to allow resuing the code for
the driver model.

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
2016-08-09 12:52:05 +02:00
Alban Bedel
50f5bb25b9 eth: asix88179: Fix receiving on big endian system
In asix_recv() the call to convert the endianess of the receive header
was applied on the wrong variable. Instead of converting rx_hdr it
converted pkt_hdr which is a pointer, and not yet initialiazed at this
point.

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
2016-08-07 21:55:43 +02:00
Alban Bedel
652b269468 eth: asix88179: Add VID:DID for Cypress GX3 USB Ethernet Adapter
Added support for the Cypress GX3 SuperSpeed to Gigabit Ethernet
Bridge Controller (VID_04b4/PID_3610).

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
2016-08-07 21:55:43 +02:00
Rajesh Bhagat
707c866f3d usb: xhci: fsl: Add code to use CONFIG_DM_USB
Adds code to use driver model for USB XHCI FSL driver

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
2016-08-07 21:55:43 +02:00
Rajesh Bhagat
ba699a5f91 usb: ehci: fsl: Add code to use CONFIG_DM_USB
Adds code to use driver model for USB EHCI FSL driver

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
2016-08-07 21:55:43 +02:00
Rajesh Bhagat
1e61ce9f7e drivers: usb: fsl: Make function for initialization to use in CONFIG_DM_USB
Moves code from ehci_hcd_init to new function ehci_fsl_init
which can be re-used in CONFIG_DM_USB.

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
2016-08-07 21:55:43 +02:00
Masahiro Yamada
2b58e1b76d usb: add (move) CONFIG_USB_HOST to Kconfig
The meaning of CONFIG_USB in U-Boot is different from that in Linux.

As you see in drivers/usb/Kconfig of Linux, CONFIG_USB enables the
USB host controller support, while CONFIG_USB_SUPPORT is used to
enable the whole of the USB sub-system.

When I added CONFIG_USB into Kconfig by commit 6e7e9294d3 ("usb:
add basic USB configs in Kconfig"), I planned to follow the Linux's
convention, i.e. CONFIG_USB to enable/disable the USB host support.

Then, commit 68f7c5db2d ("usb: Generic USB Kconfig option, that
fits both host and gadget and comments") changed the logic of the
CONFIG_USB to point to the whole of the USB sub-system.  As a result,
currently we do not have an option for USB host.

This commit adds CONFIG_USB_HOST, which will be useful to compile
in the USB host support code.

CONFIG_USB_HOST is not referenced at all, but strangely some boards
define it in board headers.  I removed them because USB_HOST will be
selected in Kconfig going forward.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-08-07 21:55:42 +02:00
Masahiro Yamada
96d8284bd5 usb: add CONFIG_USB_UHCI_HCD in Kconfig
There is no UHCI driver entry in Kconfig for now, but we have some
UHCI drivers, for example, LEON.  This is a placeholder in case we
want to move them to Kconfig in the future.

The help message was copied from Linux.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-08-07 21:55:42 +02:00
Masahiro Yamada
93cb82477d usb: add CONFIG_USB_OHCI_HCD in Kconfig
Add this option as a common config for all OHCI controllers.  Its
help message was copied from Linux.  Also, I moved it below EHCI
to respect the order in Linux's Kconfig.

Add CONFIG_USB_OHCI_HCD=y to axs103_defconfig, which is the only
user of OHCI_GENERIC.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-08-07 21:55:42 +02:00
Stefan Roese
6688452a3b net: usb: r8152: Add DM support
Add support for driver model, so that CONFIG_DM_ETH can be defined and
used with this driver.

This patch also adds the read_rom_hwaddr() callback so that the ROM MAC
address will be used to the DM part of this driver.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Ted Chen <tedchen@realtek.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Joe Hershberger <joe.hershberger@ni.com>
2016-08-07 21:55:42 +02:00
Peng Fan
bb42fb4f10 dm: ehci-mx6: support driver model
Support driver model for ehci mx6 driver.
Consolidate code to be shared between DM and non-DM, such as
introducing ehci_mx6_common_init.
For simplicity, some old fasion code are keeped for DM usage,
such as board_ehci_power and board_usb_phy_mode. And 'dr-mode',
usbphy and vbus handling code for DM is not added now.
These will be added in future patches.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Cc: Stefan Agner <stefan@agner.ch>
Cc: Simon Glass <sjg@chromium.org>
2016-08-07 21:55:42 +02:00
Tom Rini
4711e7f7af Merge branch 'master' of git://www.denx.de/git/u-boot-imx 2016-07-28 08:45:00 -04:00
Simon Glass
dec49e862e dm: zynq: usb: Convert to CONFIG_DM_USB
Convert zynq USB to driver model. Note this is tested on zynq-zybo only.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-27 14:15:54 -06:00
Simon Glass
911954859d dm: Use dm_scan_fdt_dev() directly where possible
Quite a few places have a bind() method which just calls dm_scan_fdt_dev().
We may as well call dm_scan_fdt_dev() directly. Update the code to do this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-27 14:15:54 -06:00
Simon Glass
2e3f1ff63f dm: Convert users from dm_scan_fdt_node() to dm_scan_fdt_dev()
This new function is more convenient for callers, and handles pre-relocation
situations automatically.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-27 14:15:07 -06:00
Xu Ziyuan
9424f14183 usb: dwc2 : invalidate dcache before starting DMA
Invalidate dcache before starting the DMA to ensure coherency. In case
there are any dirty lines from the DMA buffer in the cache, subsequent
cache-line replacements may corrupt the buffer in memory while the DMA
is still going on. Cache-line replacement can happen if the CPU tries to
bring some other memory locations into the cache while the DMA is going
on.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-07-25 20:44:19 -06:00
Xu Ziyuan
4711788267 usb: dwc2-otg: adjust fifo size via platform data
The total FIFO size of some SoCs may be different from the existen, this
patch supports fifo size setting from platform data.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-07-25 20:44:19 -06:00
Xu Ziyuan
fab3357916 usb: rockchip-phy: implement USB2.0 phy control
So far, Rockchip SoCs have two kinds of USB2.0 phy, such as Synopsys and
Innosilicon. This patch applys dwc2 usb driver framework to implement
phy_init() and phy_off() methods for Synopsys phy on Rockchip platform.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-07-25 20:44:19 -06:00
Siva Durga Prasad Paladugu
2cdc778b62 usb: Kconfig: Add Kconfigs entry USB_EHCI_ZYNQ
Add Kconfig entry config option for USB_EHCI_ZYNQ
and update the same to enable for all zynq boards
which supports USB

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2016-07-22 14:06:11 +02:00
Stefan Agner
c4483093f3 usb: ehci-mx6: introduce config for high active power pin
Add a new config CONFIG_MXC_USB_OTG_HACTIVE which configures the
OTG Power Pin to be high active. Low active is the reset value
of the affected configuration register, hence the config option
is named by the non-reset configuration.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
2016-07-19 19:52:14 +02:00
Stefan Agner
9a88180bfb usb: ehci-mx6: configure power polarity in usb_power_config
USBNC_n_CTRL1 bit 9 actually controls the power pin polarity.
Rename UCTRL_PM to align reference manual and set the bit in
the appropriate callback usb_power_config.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
2016-07-19 19:52:14 +02:00
Stefan Agner
2deebe2481 usb: move CONFIG_USB_EHCI_MX7 to Kconfig
Create an entry for "config USB_EHCI_MX7" in Kconfig and
switch over to it for all boards.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
2016-07-19 19:52:14 +02:00
Robert P. J. Day
62a3b7dd08 Various, unrelated tree-wide typo fixes.
Fix a number of typos, including:

     * "compatble" -> "compatible"
     * "eanbeld" -> "enabled"
     * "envrionment" -> "environment"
     * "FTD" -> "FDT" (for "flattened device tree")
     * "ommitted" -> "omitted"
     * "overriden" -> "overridden"
     * "partiton" -> "partition"
     * "propogate" -> "propagate"
     * "resourse" -> "resource"
     * "rest in piece" -> "rest in peace"
     * "suport" -> "support"
     * "varible" -> "variable"

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
2016-07-16 09:43:12 -04:00
Tom Rini
68f7289b4f Merge branch 'master' of git://git.denx.de/u-boot-usb 2016-07-01 22:35:20 -04:00
Tom Rini
44faff24f5 Merge git://git.denx.de/u-boot-fsl-qoriq 2016-06-28 15:59:05 -04:00
Prabhakar Kushwaha
49cdce1635 armv8: fsl-layerscape: Append "A" in SoC name for ARM based SoCs
Freescale ARMv8 SoC name ends with "A" to represent ARM SoCs.
like LS2080A, LS1043A, LS1012A.

So append "A" to SoC names.

Signed-off-by: Pratiyush Mohan Srivastava <pratiyush.srivastava@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
2016-06-28 12:08:53 -07:00
Steve Rae
9bc34799c8 fastboot: sparse: resync common/image-sparse.c (part 2)
- update fastboot_okay() and fastboot_fail()

This file originally came from upstream code.

While retaining the storage abstraction feature, this is the second
set of the changes required to resync with the
  cmd_flash_mmc_sparse_img()
in the file
  aboot.c
from
  https://us.codeaurora.org/cgit/quic/la/kernel/lk/plain/app/aboot/aboot.c?h=LE.BR.1.2.1

Signed-off-by: Steve Rae <srae@broadcom.com>
2016-06-27 16:37:38 -04:00
Steve Rae
64ece84854 fastboot: sparse: remove session-id logic
This "session-id" alogrithm is not required, and currently corrupts
the stored image whenever more the one "session" is required.

Signed-off-by: Steve Rae <srae@broadcom.com>
2016-06-27 16:36:33 -04:00
Peng Fan
57de41e9c9 ehci: mx7: fix otg id detection
The USBNC_PHYCFG2_ACAENB bit should be cleared to enable the
OTG ID detection, not set it. When the bit is set, the ACA
Resistance Detection is enabled, which disables the OTG ID
detection, because the internal pull up is off.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2016-06-25 00:57:10 +02:00
Peng Fan
429ff4473b ehci: mx7: fix usbnc_regs
There is a 4 bytes hole between phy_cfg2 and phy_status, fix the
usbnc_regs structure to include the hole.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2016-06-25 00:57:09 +02:00
Rajesh Bhagat
217d16973d usb: fsl: Fix NULL terminating issue for usb controller name string
Fixes NULL terminating issue for usb controller name string by using
sizeof operator.

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
2016-06-25 00:57:09 +02:00
Stephen Warren
135aa95002 clk: convert API to match reset/mailbox style
The following changes are made to the clock API:
* The concept of "clocks" and "peripheral clocks" are unified; each clock
  provider now implements a single set of clocks. This provides a simpler
  conceptual interface to clients, and better aligns with device tree
  clock bindings.
* Clocks are now identified with a single "struct clk", rather than
  requiring clients to store the clock provider device and clock identity
  values separately. For simple clock consumers, this isolates clients
  from internal details of the clock API.
* clk.h is split so it only contains the client/consumer API, whereas
  clk-uclass.h contains the provider API. This aligns with the recently
  added reset and mailbox APIs.
* clk_ops .of_xlate(), .request(), and .free() are added so providers
  can customize these operations if needed. This also aligns with the
  recently added reset and mailbox APIs.
* clk_disable() is added.
* All users of the current clock APIs are updated.
* Sandbox clock tests are updated to exercise clock lookup via DT, and
  clock enable/disable.
* rkclk_get_clk() is removed and replaced with standard APIs.

Buildman shows no clock-related errors for any board for which buildman
can download a toolchain.

test/py passes for sandbox (which invokes the dm clk test amongst
others).

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-06-19 17:05:55 -06:00
Tom Rini
a10a31ec91 Merge branch 'master' of git://git.denx.de/u-boot-usb
Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
	arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
2016-06-18 23:46:21 -04:00
Peng Fan
1e6fb0e367 usb: ehci: only shutdown opened controller
If the usb controller is not running, no need to shutdown it,
otherwise `usb stop` complains about:
"EHCI failed to shut down host controller".

To i.MX7D SDB, there are two usb ports, one Host, one OTG.
If we only plug one udisk to the Host port and then `usb start`,
the OTG controller for OTG port does not run actually. Then,
if `usb stop`, the OTG controller for OTG port will also be
shutdown, but it is not running.

This patch adds a check to only shutdown the running controller.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: "Stefan Brüns" <stefan.bruens@rwth-aachen.de>
Cc: Stephen Warren <swarren@nvidia.com>
2016-06-18 00:49:00 +02:00
Sriram Dash
ef53b8c4ce usb: xhci: fsl: Add workaround for USB erratum A008751
This patch is doing the following:
1. Implementing the errata for LS2080.
2. Adding fixup for fdt for LS2080.

Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
2016-06-13 15:16:46 +02:00
Sriram Dash
92623672f9 fsl: usb: make errata function common for PPC and ARM
This patch does the following things:
1. Makes the errata checking code common for PPC and ARM
2. Moves all these static inline functions into a dedicated C file

Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
2016-06-13 15:16:38 +02:00
Sriram Dash
bf655775f5 usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers
Performs code cleanup for device tree fixup for fsl usb controllers by
making functions to handle these similar errata checking code.

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
2016-06-13 15:16:38 +02:00
Steve Rae
f221db0ed5 usb: dwc2_udc_otg: support 8-bit interface
Define CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8 to allow the
physical interface to be 8-bit (rather than 16-bit).

Signed-off-by: Steve Rae <srae@broadcom.com>
2016-06-13 15:16:34 +02:00
Hans de Goede
bca4c3c5fc sunxi: musb: Properly turn of musb controller before booting
Turn of the clock and assert the reset when musb_stop gets called, so that
the os gets the musb controller in a pristine state. This fixes a spurious
VBus error interrupt triggering as soon as the Linux musb driver loads.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-06-10 12:09:38 +02:00
Masahiro Yamada
10db750036 usb: move CONFIG_USB_XHCI_DWC3 to Kconfig
Create an entry for "config USB_XHCI_DWC3" in Kconfig and
switch over to it for all boards.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-06-04 00:43:53 +02:00
Masahiro Yamada
0a8cc1a3a4 usb: move CONFIG_USB_XHCI to Kconfig with renaming
Move CONFIG_USB_XHCI to defconfig files for all boards, renaming it
into CONFIG_USB_XHCI_HCD.

As commented in the help of "config USB_XHCI" entry, this has been
a TODO for a long time; now CONFIG_USB_XHCI_HCD and CONFIG_USB_XHCI
have been unified in favor of the former.

Note:
Some boards define CONFIG_USB_XHCI in their headers without
CONFIG_USB, which does not meet the "depends on" in Kconfig.
I added CONFIG_USB=y for those boards when converting.
Otherwise, they would fail to build.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-06-04 00:43:53 +02:00
Roger Quadros
68a775a766 usb: phy: omap_usb_phy: Fix USB3_PHY DPLL configuration
The index returned by get_sys_clk_index() is not exactly what we expect.
Let's not rely on that and use get_sys_clk_freq() instead.

This fixes missing USB3 devices in the Linux kernel when USB is started
in u-boot. It still doesn't fix missing USB3 devices in u-boot though.

Signed-off-by: Roger Quadros <rogerq@ti.com>
2016-06-02 21:42:16 -04:00
Roger Quadros
3ac8d1ee12 usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled
It is pointless to build gadget driver if USB_GADGET is disabled.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Marek Vasut <marex@denx.de>
2016-05-27 15:39:49 -04:00
Mugunthan V N
c0c62d9233 drivers: usb: common: add common code for usb drivers to use
Add common usb code which usb drivers makes use of it.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-05-17 09:54:43 -06:00
Peng Fan
12ff19dbfd usb: gadget: dfu: discard dead code
Reported by Coverity:
Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement:
(f_dfu->strings + --i).s = ....

If calloc failed, i is still 0 and no need to call free,
so discard the dead code.

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: "Łukasz Majewski" <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
2016-05-06 20:06:56 +02:00
Stefan Roese
2bf352f0c1 usb: dwc2: Add delay to fix the USB detection problem on SoCFPGA
With patch c998da0d (usb: Change power-on / scanning timeout handling),
the USB scanning is started earlier and with a smaller timeout. This
resulted on SoCFPGA (using the DWC2 driver) in some USB sticks not
getting detected any more. This patch now adds a 1 second delay (in
the host mode only) to the DWC2 driver before the scanning is started.
With this delay, now all problematic USB keys are detected successfully
again. And there is no need any more to change the delay / timeout
in the common USB code (usb_hub.c).

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Chin Liang See <clsee@altera.com>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Marek Vasut <marex@denx.de>
2016-05-06 20:06:56 +02:00
Stefan Agner
79d867c2e6 usb: ehci-mx6: allow board_ehci_hcd_init to fail
There could be runtime determined board specific reason why a EHCI
initialization fails (e.g. ENODEV if a Port is not available). In
this case, properly return the error code.
While at it, that function (board_ehci_hcd_init) has actually two
documentation blocks... Use the correct function name for the
documentation block of board_usb_phy_mode.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2016-05-06 18:33:26 +02:00
Marek Vasut
e96e064f51 usb: dwc2: Init desc_before_addr
Initialize desc_before_addr, otherwise the USB core won't send the
first 64B Get Device Descriptor request in common/usb.c function
usb_setup_descriptor() . There are some USB devices which expect
this sequence and otherwise can misbehave.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Tom Rini <trini@konsulko.com>
2016-05-03 19:21:18 +02:00
Marek Vasut
b4fbd089e4 usb: dwc2: Make OC protection configurable
Introduce a new flag in the controller private data, which allows selectively
disabling the OC protection. Use the standard 'disable-over-current' OF prop
to set this flag. This OC protection must be disabled on EBV SoCrates rev 1.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Dinh Nguyen <dinguyen@kernel.org>
2016-05-03 19:21:18 +02:00
Marek Vasut
618da5630b usb: dwc2: Pull Ext VBUS macro from dwc_otg_core_init()
Introduce a boolean flag in the dwc2 controller private data and set
it according to the macro (for now) instead of having this macro
directly in the dwc_otg_core_init(). This will let us configure the
flag from DT or such later on, if needed.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Dinh Nguyen <dinguyen@kernel.org>
2016-05-03 19:21:17 +02:00
Marek Vasut
559019894b usb: dwc2: Pass private data into dwc_otg_core_init()
Pass the whole bulk of private data instead of just the regs,
since the private data will soon contain important configuration
flags.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Dinh Nguyen <dinguyen@kernel.org>
2016-05-03 19:21:17 +02:00
Vagrant Cascadian
eae4b2b67b Fix spelling of "occurred".
Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-05-02 18:37:09 -04:00
Roger Quadros
4d5b637843 usb: s3c-otg: Fix remaining bytes in debug messages
Remaining bytes means bytes that are not yet transferred
and not the bytes that were transferred in the last transfer.

Reported-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Tested-by: Steve Rae <srae@broadcom.com>
[Test HW: bcm28155_ap board]
2016-04-25 17:56:30 +02:00
Roger Quadros
842769ea51 usb: s3c-otg: Fix short packet for request size > ep.maxpacket
Request size can be greater than ep.packet and still end in a
short packet. We need to tackle this case as end of transfer
(if short_not_ok is not set) as indicated in USB 2.0 Specification [1],
else we get stuck up on certain protocols like fastboot.

[1] - USB2.0 Specification, Section 5.3.2 Pipes

Reported-by: Steve Rae <steve.rae@broadcom.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Tested-by: Steve Rae <steve.rae@broadcom.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
2016-04-25 17:56:30 +02:00
Roger Quadros
ac484c5a6a fastboot: Clean up bulk-out logic
Just use ep->maxpacket to get the maxpacket size
and simplify the bulk-out maxpacket alignment.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Tested-by: Steve Rae <srae@broadcom.com>
2016-04-25 17:56:30 +02:00
Roger Quadros
8b704a0e3d fastboot: Enable the respective speed endpoints at runtime
In a dual speed configuration we need to check at runtime if
we want to enable the Full-Speed or High-Speed endpoint.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Steve Rae <srae@broadcom.com>
[Test HW: bcm235xx board]
2016-04-25 17:56:30 +02:00
Roger Quadros
718156ad0a fastboot: Fix wMaxPacketSize for High-Speed IN endpoint
wMaxPacketSize for IN endpoing in High-Speed must be 512 and not 64.
While fixing that we do some clean ups like

- use cpu_to_le16(decimal_length) instead of hexadecimal length.
- No need to initialize bInterval to 0. Static variables are 0 initialized.
- Move descriptor setting from fastboot_add to to fastboot_bind.
- check for dual speed configuration before setting the high speed descriptors.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Tested-by: Steve Rae <srae@broadcom.com>
Tested-by: Steve Rae <srae@broadcom.com> [Test HW: bcm235xx board]
2016-04-25 17:56:30 +02:00
Sam Protsenko
e6c0bc0643 usb: gadget Move: CONFIG_G_DNL_* to Kconfig
And also reformat defconfigs using "make savedefconfig" rule.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2016-04-20 11:43:28 +02:00
Sam Protsenko
b142729d03 usb: dwc3: Move CONFIG_USB_DWC3_PHY_* to Kconfig
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2016-04-20 11:43:28 +02:00
Sam Protsenko
c16bf621d5 usb: dwc3: Move CONFIG_USB_DWC3_OMAP to Kconfig
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2016-04-20 11:43:28 +02:00
Sam Protsenko
65403f3010 usb: dwc3: Move CONFIG_USB_DWC3_GADGET/HOST to Kconfig
Description was borrowed from kernel dwc3 Kconfig.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2016-04-20 11:43:27 +02:00
Sam Protsenko
aaa4a9e313 usb: gadget: Move CONFIG_USB_GADGET_DOWNLOAD to Kconfig
While at it, remove obsolete CONFIG_USBDOWNLOAD_GADGET option from some
config headers. This is also probably fixes am335x_baltos board.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2016-04-20 11:43:27 +02:00
Sam Protsenko
3457bbaf22 usb: gadget: Move CONFIG_USB_GADGET_DUALSPEED to Kconfig
Move CONFIG_USB_GADGET_DUALSPEED option to Kconfig and
make all UDC controllers select USB_GADGET_DUALSPEED:
  - add next options to Kconfig selecting USB_GADGET_DUALSPEED:
    - USB_GADGET_ATMEL_USBA
    - USB_GADGET_DWC2_OTG
    - USB_DWC3
    - CI_UDC
  - make USB_MUSB_GADGET select USB_GADGET_DUALSPEED

While at it, make some related fixes:
  - remove DUALSPEED from configs that don't enable gadget support:
    - kwb.h
    - tseries.h
  - add missing USB_GADGET option to next configs:
    - novena_defconfig
    - pcm051_rev*_defconfig
    - xfi3_defconfig

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2016-04-20 11:43:27 +02:00
Sam Protsenko
a59a77f863 usb: gadget: Move CONFIG_USB_GADGET_VBUS_DRAW to Kconfig
The description was borrowed from kernel. Definitions were added to
defconfig files in a way that "make savedefconfig" generates exactly
the same file as used defconfig.

Boards using 0 mA as CONFIG_USB_GADGET_VBUS_DRAW value were moved to use
2 mA (as minimal allowed by Kconfig).

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2016-04-20 11:43:27 +02:00
John Tobias
5b718407ed USB: g_dnl: Change device class
The USB Mass Storage (ums) works in Windows, Linux and OS X (EL Capitan).
But, not in OS X (Yosemite). By applying the said patch, it extends
the ums support.

Signed-off-by: John Tobias <john.tobias.ph@gmail.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>

Test HW: Odroid XU3 (./test/py UMS + DFU tests)

Tested-by: John Tobias <john.tobias.ph@gmail.com>

Linux:
    - Run ums to expose all my eMMC partition - shows all correctly
    - Run ums to expose only 1 partition of my eMMC - show correctly

Windows:
    - Run ums to expose all my eMMC partition - it detects but it prompts,
    if I want to format it (due to a non windows partition)
    - Run ums to expose only the FAT32 partition - it show the partition
      correctly.
2016-04-20 11:43:27 +02:00
Hans de Goede
fb3bfbb24a sunxi: H3: Do not clear usb companion clk-gate / reset on remove
On the H3 we need to enable the clk and de-assert the reset of the
companion to be able to talk to the actual usb host controller.

Before this commit we were also disabling the companion clk-gate /
asserting its reset on remove, causing the later remove callback of
the companion itself to (sometimes) fail with:

ERROR: USB HC reset timed out!

This commit fixes this by not disabling the companion's clk-gate nor
asserting its reset on remove.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
2016-04-12 08:58:03 +02:00
Hans de Goede
bf31323064 musb: Properly call musb_stop() on probe failure
musb_lowlevelinit(): if no device is plugged in / detected call
musb_stop() to undo the preceding musb_start() call.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-04-10 17:18:43 +02:00
Hans de Goede
38b4a3e143 musb: sunxi: Do not allocate musb struct multiple times
The probe function of the musb host driver can be called multiple
times. The code assumes that it can save the pointer to the allocated
musb struct in the driver model priv_auto_alloc data, but this data
gets free-ed on a probe failure or on removal, so we must save the
pointer elsewhere.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-04-10 17:18:43 +02:00
Steve Rae
cf12547385 usb: bcm_udc_otg: enable clocks
Turn on the USB OTG clocks.

Signed-off-by: Steve Rae <srae@broadcom.com>
2016-04-10 17:18:43 +02:00
Sriram Dash
47435e5b18 drivers:usb:common:fsl-dt-fixup: fix return value of fdt_usb_get_node_type
Changes the return type of fdt_usb_get_node_type from char* to int

Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
2016-04-10 17:18:43 +02:00
Sriram Dash
b9f6786a88 drivers:usb:common:fsl-dt-fixup: Add device-tree fixup support for xhci controller
Enables usb device-tree fixup code to incorporate xhci controller

Signed-off-by: Ramneek Mehresh <ramneek.mehresh@nxp.com>
Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
2016-04-10 17:18:42 +02:00
Sriram Dash
469e72bc5d drivers:usb:common:fsl-dt-fixup: Remove code duplication for fdt_usb_get_node_type
Call fdt_usb_get_node_type() from fdt_fixup_usb_mode_phy_type() to
avoid code duplication.

Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Acked-by: Marek Vasut <marex@denx.de>
2016-04-10 17:18:42 +02:00
Sriram Dash
93eb8f39d2 drivers:usb:common:fsl-dt-fixup: Move device-tree fixup framework to common file
Move usb device-tree fixup framework from ehci-fsl.c to common place so
that it can be used by other drivers as well (xhci-fsl.c).

Signed-off-by: Ramneek Mehresh <ramneek.mehresh@nxp.com>
Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Acked-by: Marek Vasut <marex@denx.de>
2016-04-10 17:18:42 +02:00