summaryrefslogtreecommitdiffstats
path: root/drivers/usb
Commit message (Collapse)AuthorAgeFilesLines
* usb: imx-us-phy: implement notify_(dis)concectSascha Hauer2016-09-291-0/+27
| | | | | | | | | | | The i.MX6 USB phy does not recognize disconnects of high speed devices when the USBPHY_CTRL_ENHOSTDISCONDETECT is not set. The phy does not work properly though when this bit is always set, so implement the notify_(dis)concect() callbacks to set this bit whenever a high speed device is connected and to clear it again when the device is disconnected. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: imx-us-phy: Convert driver to generic phy supportSascha Hauer2016-09-293-4/+66
| | | | | | | The generic phy layer now supports USB phys, so convert the driver over to use it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: imx-usb-phy: Drop unnecessary read/modify/writeSascha Hauer2016-09-291-5/+2
| | | | | | | When writing to the USBPHY_CTRL register read/modify/write is unncessary since we are writing to the associated bit set register anyway. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: ehci: forward phy given in registration data to hostSascha Hauer2016-09-291-0/+1
| | | | | | | Allow to pass a phy in the registration data and forward it to the usb_host structure. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* 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>
* ARM: i.MX drivers: enable i.MX50 where already supportedAlexander Kurz2016-09-121-0/+6
| | | | | | | | The i.MX50 SOC includes one ESDHCv3, three ESDHCv2, one cspi and two ecspi instances which are supported by existing drivers. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: i.MX chipidea: Enable VBUS regulator when neededSascha Hauer2016-09-051-4/+13
| | | | | | | We should enable VBUS only in host mode, not unconditionally during probe(). Fix that. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: chipidea i.MX: Do not return unnecessary errorSascha Hauer2016-08-291-3/+8
| | | | | | | | | We only allow to setup the host/peripheral role once, when it's already set then we return -EBUSY. Return 0 instead when we set the same role again and only return -EBUSY when we actually try to change the role. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: Move bulk of boot.h to bootm.hSascha Hauer2016-07-261-1/+1
| | | | | | | | The majority of the stuff currently in include/boot.h is about bootm code implemented common/bootm.c. To be more consistent move it to a new file include/bootm.h. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: gadget: composite: avoid possible NULL ptr dereferenceLucas Stach2016-07-071-1/+3
| | | | | | | Check if g is valid before trying to dereference it. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: ehci: honour timeout valueSascha Hauer2016-07-061-4/+4
| | | | | | | usb_control_msg() and usb_bulk_msg() have a timeout parameter. Honour this in the ehci driver instead of using a default timeout. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: fastboot: Fix oem exec supportSascha Hauer2016-05-101-1/+1
| | | | | | | | | Fixes: b1374a6 usb: fastboot: drop CONFIG_COMMAND_SUPPORT dependency The correct config option to depend on is CONFIG_COMMAND_SUPPORT, not CONFIG_COMMAND. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubiformat'Sascha Hauer2016-05-092-7/+16
|\
| * usb: fastboot: drop CONFIG_COMMAND_SUPPORT dependencySascha Hauer2016-04-262-1/+5
| | | | | | | | | | | | | | fastboot can run without command support. In this case we cannot execute oem commands. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: fastboot: Use C API for ubiformatSascha Hauer2016-04-261-5/+11
| | | | | | | | | | | | | | | | This makes it possible to compile the fastboot gadget without command support. While at it bail out when ubiformat is not compiled in. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/include-cleanup'Sascha Hauer2016-05-093-5/+7
|\ \ | |/ |/|
| * string: Fix (v)asprintf prototypesSascha Hauer2016-04-153-5/+6
| | | | | | | | | | | | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include: move run_command prototype to command.hSascha Hauer2016-04-151-0/+1
| | | | | | | | | | | | run_command fits much better into command.h, move it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fix erasing/protecting flashes with unspecified sizeSascha Hauer2016-04-192-3/+3
|/ | | | | | | | | | | | | | | | | fixes: 81737c1 mtd: Fix erasing of devices >4GiB Several places erased a complete flash partition passing ~0 as count to erase(). With the above commit count to erase was changed from an unsigned type to a signed type, so the (count > f->size - offset) check in erase() no longer triggers and the ~0 count is no longer adjusted to the whole device size. Among other things this results in saveenv failures on NOR flashes. This patch fixes this by introducing an explicit macro for erasing the whole device which is tested for in erase(). All other negative values are rejected. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Giorgio <giorgio.nicole@arcor.de>
* Merge branch 'for-next/misc'Sascha Hauer2016-03-111-19/+2
|\
| * ehci-hcd: preserve DTC in QH for interrupt transactionsAleksey Kuleshov2016-03-101-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | In Linux ehci-q Data Toggle Control bit for interrupt transactions is preserved in Queue Head (EHCI 3.6.2). So don't set 14's bit in qh_endpt1 and don't manage toggle bit anywhere in int transactions. This fixes an idle issue for USB keyboards, where keys were physically changed but barebox haven't seen them in polling until the next USB keyboard polling occurs. Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ehci-hcd: remove useless timeoutAleksey Kuleshov2016-03-101-8/+0
| | | | | | | | | | | | | | This is just a regular iteration loop so no timeout needed Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/driver'Sascha Hauer2016-03-1112-38/+74
|\ \
| * | driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-0712-38/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | driver: Fix return check of dev_request_mem_regionSascha Hauer2016-02-234-8/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region returns an ERR_PTR, fix places which check for a NULL pointer instead. This patch has been generated with this semantic patch, written by me and improved by Andrey Smirnov: // <smpl> @@ expression e; expression e1; @@ e = dev_request_mem_region(...); ... -if (!e) - return e1; +if (IS_ERR(e)) + return PTR_ERR(e); @ rule1 @ expression e; @@ e = dev_request_mem_region(...); @@ expression rule1.e; identifier ret, label; constant errno; @@ if (!e) { ... ( - ret = -errno; + ret = PTR_ERR(e); ... goto label; | - return -errno; + return PTR_ERR(e); ) } @depends on rule1@ expression rule1.e; @@ - if (e == NULL) + if (IS_ERR(e)) { ... } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
* | Merge branch 'for-next/bbu'Sascha Hauer2016-03-111-1/+47
|\ \
| * | fastboot: Add a ARM Barebox filetype handlerMarkus Pargmann2016-03-111-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | This will automatically call barebox_update for the transfered file if it is an ARM Barebox image and the destination file is defined by some update handler. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fastboot: Fix usage of ubiformat for UBI image transfersMarkus Pargmann2016-02-181-1/+16
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Currently all fastboot flash commands with UBI images are handled by a final call to 'ubiformat'. This only makes sense for flash commands where the target file is a mtd device. If we just want to transfer a UBI image we would expect a simple copy to the correct location. This patch checks if the destination file is a MTD device by opening it and calling an ioctl MEMGETINFO. Only for MTD devices, ubiformat is called. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / USB: imx-usb-phy: Fix uninitialized use of variableSascha Hauer2016-03-101-0/+1
|/ | | | | | ret may no be initialized in the error path when clk_get fails. Fix it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Introduce include/linux/spinlock.hYegor Yefremov2016-02-013-0/+3
| | | | | | | Move spinlock related definitions to its original place. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: chipidea-imx: check return value of regulator_get()David Jander2016-01-081-1/+2
| | | | | | | | | | The VBUS regulator is optional for the chipidea-imx glue, so it must be checked if regulator_get provided a valid regulator handle before trying to enable the regulator. Signed-off-by: David Jander <david@protonic.nl> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: mx25: fix bit position of "Host power mask"Uwe Kleine-König2015-11-091-1/+1
| | | | | | | | | | | | | | | | | The bit MX25_H1_PM_BIT value is handled for port 1 as MX25_OTG_PM_BIT is for port 0. The latter is called "OPM: OTG power mask" in the i.MX25 reference manual. Its description matches the description of "HPM: Host power mask" for the host port which is bit 16, not 8. The Linux kernel (as of 4.3) also has #define MX25_H1_PM_BIT BIT(16) . Fixes: a4076ddf6577 ("USB i.MX: Add chipidea driver support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: ehci-hcd: Use regular mdelay()Sascha Hauer2015-10-141-1/+3
| | | | | | | The USB core will make sure we do not re-enter the ehci driver, so we can use regular mdelay instead of mdelay_non_interruptible(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "usb: ehci-hcd: detect re-entrance"Sascha Hauer2015-10-141-38/+4
| | | | | | | Now that the USB core makes sure that we do not re-enter USB drivers we no longer have to detect re-entrancy in the ehci driver. This reverts commit 8426cc641dbd9c4e948ae4b5f3f89463e969eb1e.
* Revert "usb: ehci-hcd: use mdelay_non_interruptible()"Sascha Hauer2015-10-141-3/+3
| | | | | | | | Now that the USB core makes sure that we do not re-enter USB drivers we no longer need mdelay_non_interruptible() but can use regular mdelay() again. This reverts commit 4cfd909412e6ecfcef21c1ffabc8d515b39a0f85.
* 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>
* Merge branch 'for-next/usb'Sascha Hauer2015-10-075-19/+500
|\
| * 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-hcd: use mdelay_non_interruptible()Peter Mamonov2015-10-021-3/+3
| | | | | | | | | | Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: ehci-hcd: detect re-entrancePeter Mamonov2015-10-021-4/+38
| | | | | | | | | | Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: ehci-hcd: port periodic transactions implementation from the u-bootPeter Mamonov2015-10-022-2/+415
| | | | | | | | | | Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: chipidea: Add udc unregister for device removalMarkus Pargmann2015-09-232-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | The host may assume that the usb device is still up and running after booting if we do not deregister the udc here. I observed issues when the linux kernel was using a usb gadget directly where the complete USB Hub got disconnected through this. This patch adds a proper USB disconnect for gadget devices. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: ehci-hcd: use is_timeout_non_interruptible()Peter Mamonov2015-09-101-2/+2
| | | | | | | | | | | | | | | | | | Use is_timeout_non_interruptible() intead of is_timeout() to avoid re-entering ehci-hcd functions from pollers, registered by usb drivers. Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: ehci-hcd: add OF bindingsPeter Mamonov2015-09-041-4/+18
| | | | | | | | | | Signed-off-by: Peter Mamonov <pmamonov@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>
* | Merge branch 'for-next/misc'Sascha Hauer2015-10-072-2/+2
|\ \
| * | introduce strerrorpSascha Hauer2015-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | putting an error pointer into strerror can be a bit confusing since strerror takes a positive error code but PTR_ERR returns a negative number, so we have to do strerror(-PTR_ERR(errp)). Some places got this wrong already, so introduce a strerrorp function which directly takes an error pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: storage: fix warning: no previous prototype for ↵Antony Pavlov2015-09-141-1/+1
| |/ | | | | | | | | | | | | 'usb_stor_Bulk_clear_endpt_stall' Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / chipidea-imx: allow phymode configuration in pdataEric Bénard2015-09-291-0/+1
|/ | | | | | | | | it's currently only handled through DT and for i.MX25 OTG port (at least), we need to configure portsc to get host mode working but it actually fails as ci->phymode is 0 which is USBPHY_INTERFACE_MODE_UNKNOWN Signed-off-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>