9
0
Fork 0
Commit Graph

306 Commits

Author SHA1 Message Date
Sebastian Hesselbarth 11045f866d USB: xHCI: Sync non-coherent DMA buffers
When working with non-coherent transfer buffers, we have to sync
device and cpu for outgoing and incoming buffers. Fix the driver where
non-coherent buffers are used in device context.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-15 14:05:42 +02:00
Lucas Stach b9f4cd150b usb: host: xhci: depend on HAS_DMA
The driver needs the dma coherent function and thus can
only work on architectures implementing them.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-26 07:48:03 +01:00
Lucas Stach 0ba21609c4 usb: host: ohci: convert to streaming DMA ops
Move to the common streaming DMA ops in order to get rid of
the direct usage of the ARM MMU functions for the cache
maintenance.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:53:48 +01:00
Lucas Stach 602d399e63 usb: host: ehci: convert to streaming DMA ops
Move to the common streaming DMA ops in order to get rid of
the direct usage of the ARM MMU functions for the cache
maintenance.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:53:48 +01:00
Lucas Stach 3f1dee9c76 usb: gadget: fsl_udc: convert to streaming DMA ops
Move to the common streaming DMA ops in order to get rid of
the direct usage of the ARM MMU functions for the cache
maintenance.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:53:48 +01:00
Lucas Stach 381f034ed6 ARM: move DMA alloc functions to dma.h
This better separates the DMA from the MMU functionality.

Also move all drivers that only depends on asm/mmu.h for the alloc
functions over to the common header.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:52:02 +01:00
Lucas Stach e05f9586b3 ARM: change dma_alloc/free_coherent to match other architectures
As a lot drivers currently rely on the 1:1 virt->phys mapping on ARM
we define DMA_ADDRESS_BROKEN to mark them. In order to use them on
other architectures with a different mapping they need proper fixing.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:51:47 +01:00
Sascha Hauer ce961e3412 Merge branch 'for-next/misc' 2015-02-04 19:09:15 +01:00
Bo Shen 3ee82c6779 usb: at91_udc: pass the vbus initial value
If without pass the vbus initial value, the vbus status alway
present as 0 even if the vbus is connected to 5v.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-04 12:53:58 +01:00
Masahiro Yamada 262eef7c6a usb: abolish wait_ms() function
This function is only used in drivers/usb/*.
It is equivalent to mdelay().

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-02 11:46:30 +01:00
Lucas Stach e98a7e85b1 usb: musb-dsps: select OFDEVICE
Fixes:
In function `dsps_probe': undefined reference to `of_usb_get_dr_mode'

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-19 08:47:13 +01:00
Jean-Christophe PLAGNIOL-VILLARD a1a582f4e0 console: allow to specify the device id
so we can use dynamic number id with specific devname

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-13 08:48:59 +01:00
Lucas Stach 8f0493d431 usb: gadget: fastboot: allow to build without BOOTM
This will disable the capability to boot an uploaded image directly,
but keeps other fastboot functionality. This seems like a valid config.

Fixes:
In function `do_bootm_on_complete': undefined reference to `bootm_boot'

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-17 11:02:42 +01:00
Sascha Hauer 9969c68a89 USB: Gadget: fastboot: depends on command support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-27 17:15:19 +01:00
Sascha Hauer 6f4f1c31a6 USB: Gadget: Select poller from USB_GADGET option
The poller has been merged to the gadget core, so
now the core needs poller support, not the individual drivers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-27 17:15:15 +01:00
Lucas Stach 88628367db usb: musb: only build musb_barebox if host is enabled
musb_barebox.c contains code that is only ever used if CONFIG_MUSB_HOST
is set. Building it uncoditionally breaks the build depending on the link
order.

Fixes:
drivers/usb/musb/musb_barebox.c:64: undefined reference to `musb_urb_enqueue'

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-27 17:12:39 +01:00
Lucas Stach 0f1078d5cc usb: host: only activate Efika MX ULPI workaround if ULPI is selected
Fixes a build failure with disabled ULPI support.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-26 19:21:09 +01:00
Lucas Stach 2d22fca0e7 usb: gadget: fastboot: select BANNER
Fastboot gadget needs the 'release_string' which is available only
if CONFIG_BANNER is set.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-24 14:04:11 +01:00
Lucas Stach 672a4972dd dfu: fix possible usage of uninitialized var
The error path would in fact use the status
variable without it being initialized first.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-21 13:02:48 +02:00
Dmitry Voytik d8f5a28be3 usb: ehci-hcd: Correct CLEAR_FEATURE code
This commit broke USB on olinuxino board:

  87b9bea USB: host: hub: Use usb_hub_power_on from U-Boot

This patch was ported from U-Boot with small changes. See discussion:
http://lists.denx.de/pipermail/u-boot/2013-May/153920.html

The root cause seems to be a missing mask and missing 'break' in
ehci-hcd.c. Fix both.

Signed-off-by: Dmitry Voytik <voytikd@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-21 12:57:25 +02:00
Sascha Hauer fa93e4fb60 Merge branch 'for-next/resource-err-ptr' 2014-10-02 08:54:42 +02:00
Sascha Hauer 6850ccff66 USB: MUSB: Add barebox specific changes
This changes the MUSB support from the original Kernel state to
be usable with barebox. Tested on a custom board and the Beaglebone
Black. The host port on the Beaglebone works, the OTG port works
in device mode, but not yet in host mode.

Based on the initial MUSB port from Rolf Evers Fischer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-26 21:36:58 +02:00
Sascha Hauer 12aeca8373 USB: Add MUSB driver from Linux
This adds the necessary files from the MUSB driver directly from Linux
3.17-rc5. No changes to the original files have been made so far.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-26 21:36:58 +02:00
Sascha Hauer 98cbf263bd USB: gadget: allow multiple udc drivers
Since the MUSB driver will have it's own directory the Kconfig
entries won't be in drivers/usb/gadget/Kconfig. This is incompatible
with the current 'choice' approach for udc drivers. The udc drivers
do not implement the global usb_gadget_poll() anymore, so we can
drop the choice and allow multiple gadget drivers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-26 21:36:57 +02:00
Sascha Hauer 18d588da74 USB: gadget: put poller into core
Instead of letting each driver implement usb_gadget_poll directly
implement this function in the core which then calls into the
drivers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-26 21:36:54 +02:00
Sascha Hauer 01beb0d5f2 USB: add usb phy header file
Mostly taken from the Linux Kernel to ease porting phy
handling code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-26 08:49:21 +02:00
Sascha Hauer b1536a3298 USB: gadget: dfu: Add max_speed to dfu_driver
The MUSB driver checks for this field. If it doesn't contain
something useful the driver bails out.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-25 16:25:46 +02:00
Sascha Hauer bab50309e7 USB: gadget: fastboot: Add missing include
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-25 16:25:02 +02:00
Sascha Hauer ed6e965824 resource: Let dev_request_mem_region return an error pointer
For all users fix or add the error check.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-16 08:32:10 +02:00
Sascha Hauer 45615e3ec1 Merge branch 'for-next/usb-host'
Conflicts:
	drivers/usb/core/Makefile
2014-08-07 20:34:39 +02:00
Sascha Hauer 7782c08047 Merge branch 'for-next/usb-gadget'
Conflicts:
	commands/Makefile
	common/Kconfig
	common/Makefile
	drivers/usb/gadget/dfu.c
2014-08-07 20:34:28 +02:00
Sascha Hauer 038be0fbb5 Merge branch 'for-next/usb' 2014-08-07 13:13:47 +02:00
Sascha Hauer 38c3b2455e Merge branch 'for-next/misc'
Conflicts:
	lib/Makefile
2014-08-07 13:13:31 +02:00
Sascha Hauer 5b7b7ee5d9 Merge branch 'for-next/metadata'
Conflicts:
	arch/arm/dts/Makefile
	common/Makefile
	lib/Makefile
2014-08-07 06:15:16 +02:00
Sascha Hauer 3cfa4bc00c move file helper functions to separate file
We have our file helper functions in several places. Move them
all to lib/libfile.c.
With this we no longer have file helpers in fs/fs.c which contains
the core fs functions and no functions in lib/libbb.c which are
not from busybox.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-08-07 06:13:51 +02:00
Antony Pavlov 92466472c2 usb: ehci: use linux-way ehci_readl and ehci_writel
Also drop nowhere defined CONFIG_EHCI_DESC_BIG_ENDIAN.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-28 07:35:01 +02:00
Sebastian Hesselbarth b8d2d4923f USB: host: add xHCI PCI driver
This adds a driver for PCI-attached xHCI controllers.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-28 07:31:18 +02:00
Sebastian Hesselbarth 237bad9cc7 USB: host: add xHCI HCD, Hub, and platform driver
This adds support for xHCI USB 3.0 host controllers found on various
SoCs and PCI devices. Currently, the driver only supports the virtual
USB 2.0 ports of the host controller, so if you plan to use USB 3.0
devices, put a USB 2.0 cable in between.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-28 07:31:18 +02:00
Sebastian Hesselbarth 343ccff163 USB: EHCI: use min3 from Linux
EHCI HCD has a private version of min3() determining the smallest
number out of 3. We already have min()/max() imported from Linux,
also get min3()/max3() and use it instead of EHCI's private one.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-28 07:31:18 +02:00
Sebastian Hesselbarth 418add62c1 USB: improve error paths and tear-down
USB core isn't too strict about allocation/deallocation and
add/remove sequences of usb devices. Especially, error paths
and device tear-down are kind of broken and cause hangs on
failing usb device detect.

This patch improves the situation by introducing a
usb_free_device() that tears down allocated resources by
usb_alloc_new_device(). usb_remove_device() now only deals
with resources that have been added by usb_new_device().
Also, error handling is fixed or improved to ensure that no
devices are unregistered that have not been previously
registered.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-28 07:31:18 +02:00
Sebastian Hesselbarth 8938752dd8 USB: Count detected USB devices independent of dev_index
Adding a usb device increases dev_index every time a new device is
allocated. Removing a usb device does not decrease again, of course.
As we print the number of detected usb devices after each usb bus
scan based on dev_index, we cannot trust dev_index here. Keep track
of the correct number of (currently) detected usb devices by
introducing an independent dev_count that gets increased on detect
and decreased on remove.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-28 07:31:18 +02:00
Sebastian Hesselbarth 422cd55ca8 USB: Fix stale usb devices in usb_device_list
New usb devices are added to a list of usb devices, but when removing
the corresponding usb_device it was not removed from that list. Fix it
by deleting it properly from the usb_device_list.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-28 07:31:17 +02:00
Sebastian Hesselbarth 6931e9007c USB: Use descriptors from ch11.h
Use the descriptors from ch11.h instead of duplicating them
in usb.h. usb_hub_descriptor now contains a union .u to differentiate
HS hub descriptor from SS hub descriptor.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-24 08:57:57 +02:00
Sebastian Hesselbarth f261bce3a6 USB: EHCI: use descriptor length fields
Instead of hard-coding descriptor length, pick it from the
corresponding descriptor.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-24 08:57:57 +02:00
Sebastian Hesselbarth 756c95b764 USB: EHCI: make use of defines for descriptors
Now that we have a full set of defines for each descriptor field,
make use of it for the EHCI HCD descriptors.

This fixes endianess issues for .device.bcdUSB, .device.bcdDevice,
.config.wTotalLength, and .endpoint.wMaxPacketSize.

Also, .endpoint.bInterval was set to 0 instead of 255 due to a
copy-and-paste error while assigning u8[] to usb_endpoint_descriptor.

This also is a preparation for including ch11.h later, which has
a modified usb_hub_descriptor for USB 3.0.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-24 08:57:57 +02:00
Sebastian Hesselbarth 3c91719f14 USB: EHCI: reuse ch9.h config and interface descriptors
Now that usb_config_descriptor and usb_interface_descriptor are clean
of any additional fields, drop the duplication in EHCI code and use
the default ones.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-24 08:57:57 +02:00
Sebastian Hesselbarth 60ebedf1e7 USB: Move FooRequest defines and add class requests
{Device,Interface,Endpoint}Requests are currently defined in private
ehci.h but are also useful for other drivers than ehci-hcd. Move them
to usb/usb_defs.h and also add some more class requests.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-24 08:57:57 +02:00
Sebastian Hesselbarth 186f164af0 USB: fix PowerPowerCtrlMask assignment
usb_hub_configure() gets the hub descriptor and copies its values
over to a local descriptor.

While copying PortPowerCtrlMask it erroneously overwrites
DeviceRemovable due to a copy-and-paste error. Fix it up.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-24 08:57:57 +02:00
Sascha Hauer 43ab9db1b1 USB: gadget: fsl_udc: Be more tolerant in fsl_ep_dequeue
When an endpoint hasn't been enabled ep->desc is NULL and
fsl_ep_dequeue crashes with a NULL pointer dereference. Check
ep->desc before continuing.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-24 08:32:57 +02:00
Sascha Hauer bfb7aa1e19 USB: gadget: Add a multi function gadget
Similar to the Kernel multi function this gadget driver is used
for creating a USB device with multiple functions. This is
created and removed with the newly created 'usbgadget' command.
Based on the options it creates combinations of DFU, fastboot
and serial USB functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-24 08:32:56 +02:00