summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
Commit message (Collapse)AuthorAgeFilesLines
* usb: Add usb phy to usb hostSascha Hauer2016-09-291-0/+8
| | | | | | | | Add a struct usb_phy * member to struct usb_host. Also, call usb_phy_notify_connect() / usb_phy_notify_disconnect() when there are connection changes on the root hub. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: Use standard debug macroSascha Hauer2016-09-281-27/+25
| | | | | | Use standard pr_debug instead of homebrew USB_PRINTF Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: core: return -EAGAIN on usb_* functions reentrancePeter Mamonov2015-10-141-1/+39
| | | | | Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: core: drop unnecessary le16_to_cpu() conversionAntony Pavlov2015-10-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | In drivers/usb/core/usb.c we already have le16_to_cpus() conversion just after usb_get_descriptor(): 390 /* correct le values */ 391 le16_to_cpus(&dev->descriptor->bcdUSB); 392 le16_to_cpus(&dev->descriptor->idVendor); 393 le16_to_cpus(&dev->descriptor->idProduct); 394 le16_to_cpus(&dev->descriptor->bcdDevice); so no additional idVendor/idProduct descriptor fields le16_to_cpu() conversion is needed after that. On the big-endian machines extra le16_to_cpu() conversion leads to wrong idVendor/idProduct USB device parameters values (e.g. see devinfo <usb-device> output), and to a much more serious problem: idVendor/idProduct-based USB device detection does not work. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: ehci: fix include/usb/usb.h:'struct usb_configuration' misuseAntony Pavlov2015-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | See the commit commit 245069bcef15ecc19db616a967501349b76c84d0 Author: Sascha Hauer <s.hauer@pengutronix.de> Date: Thu Jul 10 11:36:12 2014 +0200 USB: introduce usb_interface/usb_configuration structs On little endian systems like ARM the le16_to_cpus() macro is a no op, defined as: #define le16_to_cpus __le16_to_cpus #define __le16_to_cpus(x) do {} while (0) So struct usb_configuration field misuse was discovered on big-endian MIPS machine. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: increase USB_CNTL_TIMEOUT to match linuxSteffen Trumtrar2015-05-041-2/+2
| | | | | | | | | | | | | | | | | | | | | USB requests should be processed within a timeframe of 5s. The linux kernel also uses this timeout value for the control packets. For the musb the increase in timeout helps successfully probing USB devices (at least on one test hardware), but on the other hand doesn't slow down the system, if there are no devices, i.e. the timeout never hits. That means, that the USB core correctly aborts instead of timing out. Why and how the 100ms was chosen in the first place, can not be deduced from the git history, just that it seems to work fine for most boards. Change USB_CNTL_TIMEOUT to 5000ms and replace all occurences of `USB_CNTL_TIMEOUT * x` with just `USB_CNTL_TIMEOUT`, as the timeout is now large enough without it. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: abolish wait_ms() functionMasahiro Yamada2015-02-022-5/+5
| | | | | | | | 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>
* USB: add usb phy header fileSascha Hauer2014-09-261-0/+1
| | | | | | | Mostly taken from the Linux Kernel to ease porting phy handling code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb-host'Sascha Hauer2014-08-075-465/+566
|\ | | | | | | | | Conflicts: drivers/usb/core/Makefile
| * USB: improve error paths and tear-downSebastian Hesselbarth2014-07-283-27/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * USB: Count detected USB devices independent of dev_indexSebastian Hesselbarth2014-07-281-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * USB: Fix stale usb devices in usb_device_listSebastian Hesselbarth2014-07-281-0/+1
| | | | | | | | | | | | | | | | | | 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>
| * USB: Use descriptors from ch11.hSebastian Hesselbarth2014-07-241-5/+5
| | | | | | | | | | | | | | | | | | 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>
| * USB: fix PowerPowerCtrlMask assignmentSebastian Hesselbarth2014-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
| * USB: host: drop force rescanSascha Hauer2014-07-181-27/+12
| | | | | | | | | | | | | | | | We can now detect changes in the USB device hierarchy properly, so the 'force' option to the usb command is no longer necessary. We just scan the busses each time the usb command is called. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * USB: host: detect port change only once in usb_hub_configure_portSascha Hauer2014-07-181-2/+8
| | | | | | | | | | | | | | Otherwise a device may be registered/unregistered multiple times during scanning the hub ports. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * USB: host: implement usb_remove_deviceSascha Hauer2014-07-183-0/+21
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * USB: host: hub: only configure hub onceSascha Hauer2014-07-181-1/+8
| | | | | | | | | | | | | | | | | | | | We had a single function which configures the hub and scans the ports. Split this up and configure the hub only once and scan the ports during detect() time. This allows to plug in additional devices into a hub while continuing to use the already existing devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * USB: host: factor out port configuration to separate functionSascha Hauer2014-07-181-51/+74
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * USB: host: hub: Use usb_hub_power_on from U-BootSascha Hauer2014-07-181-1/+18
| | | | | | | | | | | | | | | | U-Boots power good delay function is more conservative than ours. Use it to be on the safe side. The U-Boot guys have discussed a lot about it, let's hope they got it right. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * USB: host: hub: Use dev_dbgSascha Hauer2014-07-181-48/+40
| | | | | | | | | | | | | | Now that a hub is a driver use dev_dbg rather than plain printf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * USB: host: fixup USB device hierarchySascha Hauer2014-07-182-2/+2
| | | | | | | | | | | | | | Make all USB devices children to the hub device they are attached to. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * USB: host: hub: Turn into a driverSascha Hauer2014-07-185-415/+460
| | | | | | | | | | | | | | | | Since we have a driver model we can make the hub driver a real driver model driver. Put it into a new file to separate the hub from the USB core stuff. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * USB: host: simplify usb_new_deviceSascha Hauer2014-07-181-18/+5
| | | | | | | | | | | | | | | | | | usb_new_device tries to find the port number it is attached to by iterating over the parents children and using the loop counter index as port number. Instead, just use the portnr field in struct usb_device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * commands: usb: add tree view capabilityAntony Pavlov2014-07-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds U-Boot 'usb tree' command functionality to barebox. Here is an example output: 1 ID 0000:0000 | u-boot EHCI Host Controller | +-2 ID 05e3:0606 | USB2.0 Hub | +-3 ID 10c4:ea60 | Silicon Labs CP2102 USB to UART Bridge Contr P-00-00669 | +-4 ID 05e3:0606 | | USB2.0 Hub | | | +-5 ID 05e3:0608 | | | USB2.0 Hub | | | | | +-6 ID 0d8c:000c | | C-Media USB Headphone Set | | | +-7 ID 0d8c:000c | C-Media USB Headphone Set | +-8 ID 0846:1040 NETGEAR NETGEAR FA120 Adapter The tree view is enabled with 'usb -t' Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | USB: gadget: Update to 3.15Sascha Hauer2014-07-223-0/+21
|/ | | | | | | | | This updates the USB Gadget stack to Linux-3.15. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Conflicts: drivers/usb/core/Makefile
* USB: introduce usb_interface/usb_configuration structsSascha Hauer2014-07-181-26/+26
| | | | | | | | | | | Currently we have two conflicting definitions of struct usb_config_descriptor and struct usb_interface_descriptor in the tree. This is because the USB code uses additional fields in the structs for internal housekeeping. Add struct usb_interface and struct struct usb_configuration with the housekeeping data and embed the corresponding hardware structs into them. This frees the way to use the definitions from ch9.h in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: Kconfig: introduce USB_HOST symbolSascha Hauer2014-07-181-1/+1
| | | | | | | | | This renames USB to USB_HOST since this is what the symbol really means. Introduce a USB symbol which is selected by both USB_GADGET and USB_HOST. This gives us a symbol to let common USB code depend on. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: fix signedness mixups in printf format specifiersLucas Stach2014-04-231-2/+2
| | | | | | | | | This most likely doesn't fix any real bugs, but it's the right thing to do and reduces the noise level with static checkers. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove redundant NULL check on freeLucas Stach2014-02-101-2/+1
| | | | | | | | free() already checks the pointer to be non NULL. No need to do it again. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: i.MX: Make DT dr_mode & phy_type parameters kernel compatibleAlexander Shiyan2013-10-301-2/+2
| | | | | | | | | Since the mainline kernel now has its own dr_mode and phy_type DT-options for setting modes of USB ports, do these kernel parameters compatible by removing "barebox" prefix. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: Turn some printf into pr_*Sascha Hauer2013-09-271-3/+3
| | | | | | So that these messages can be suppressed if necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: make usb devices children of the corresponding hostSascha Hauer2013-09-241-0/+2
| | | | | | To be able to find usb devices in the hardware tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: implement a usb_host_detect to scan individual USB hostsSascha Hauer2013-06-211-13/+25
| | | | | | | | Currently we can only (re)scan all USB hosts. Add a function to scan individual hosts. This is useful for implementing the detect callback in the next patch. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: move scanned status into coreSascha Hauer2013-06-211-1/+8
| | | | | | | A command should not be interested in the internal USB core state, so move the state handling into the core. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: rename USB devices to reflect bus structureSascha Hauer2013-06-211-3/+11
| | | | | | | | | This renames the USB devices to reflect the bus structure. The base name for a USB device is usb<devno>. For each child device we add a -<parent-port-no>. This makes it more easy to identify devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: Add devicetree helpersSascha Hauer2013-05-302-0/+92
| | | | | | Add helpers to get the dr_mode and the phy_mode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Use dev_add_param_int_ro where possibleSascha Hauer2013-04-111-9/+10
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: add parameters info on usb deviceJean-Christophe PLAGNIOL-VILLARD2013-01-231-0/+14
| | | | | | | | | | | | | | iManufacturer = 0 iProduct = 1 iSerialNumber = 0 Manufacturer = Product = OHCI Root Hub SerialNumber = idVendor = 0000 idProduct = 0000 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/remove-fsf-address'Sascha Hauer2012-10-031-4/+0
|\ | | | | | | | | | | Conflicts: drivers/net/miidev.c include/miidev.h
| * Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | | | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | driver: register busJean-Christophe PLAGNIOL-VILLARD2012-09-231-0/+5
|/ | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2012-09-051-1/+2
|\
| * usb: use ep-specific pwrgood delaySteffen Trumtrar2012-08-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | In usb_hub_configure the hub is asked for its descriptor and among other things its bPwrOn2PwrGood time. In the actual hub_power_on function this information was not used and a hardcoded value was used instead. For some hubs this delay is to short. So, use the delay the hub wants. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | trivial: fix spelling in usb codeSteffen Trumtrar2012-08-311-2/+2
|/ | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB core: Allocate tmpbuf using dma_allocSascha Hauer2012-06-301-11/+18
| | | | | | This needs to be dma save. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB core: device descriptor using dma_allocSascha Hauer2012-06-301-25/+28
| | | | | | The device descriptor needs to be dma save. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB core: allocate setup_packet using dma_allocSascha Hauer2012-06-301-7/+11
| | | | | | The setup packet needs to be dma save. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: fix driver nameJean-Christophe PLAGNIOL-VILLARD2012-04-231-0/+1
| | | | | | | | use the usb_driver name otherwise we will have a NULL driver entry in devinfo Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* USB ehci: speed up initializationSascha Hauer2012-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | This is based on the following U-Boot commit: commit 5f4b4f2fed3ab8590c8c06b78642f8c1467acacf Author: Vincent Palatin <vpalatin@chromium.org> Date: Mon Dec 5 14:52:22 2011 -0800 ehci: speed up initialization According to EHCI specification v1.0, the controller should stabilize the power on a port at most 20 ms after the port power bit transition. So, we put this setting in the virtual descriptor corresponding field, (bPwrOn2PwrGood = 10 => 10 x 2ms = 20ms), this saves about 500ms at each controller initialization/enumeration. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>