summaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)Author
2016-09-29usb: chipidea: Use extcon framework for ID and VBUS detectionSanchayan Maity
Rather than relying on special USB/PHY pins/registers use the generic extcon framework with its extcon-usb-gpio implementation to detect ID and VBUS changes. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
2016-07-18Merge remote-tracking branch 'nxp/imx_4.1.15_1.0.0_ga' into ↵Stefan Agner
toradex_imx_4.1.15_1.0.0_ga-next
2016-06-24chipidea: make usb charger optionalMax Krummenacher
The USB charger functionality depends on functions provided by CONFIG_POWER_SUPPLY but this dependency is not forced through Kconfig. Don't compile the functionality in when CONFIG_POWER_SUPPLY is not set. This fixes linker errors of not found symbols. power_supply_changed power_supply_register power_supply_unregister Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
2016-05-31MLK-12860-4 usb: chipidea: imx: add HSIC support for imx7dPeter Chen
Add HSIC support for imx7d. We have not supported HSIC as system wakeup as well as HSIC remote wakeup function at DSM mode, since the 24M OSC can't be off and the SoC internal regulators can't be off at this mode, that will keep power consumption much higher. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2016-05-23MLK-12421 usb: chipidea: fix build warning if disable CONFIG_USB_CHIPIDEA_HOSTLi Jun
Fix chipidea usb driver compile warning if CONFIG_USB_CHIPIDEA_HOST is disabled: In file included from drivers/usb/chipidea/otg.c:26:0: drivers/usb/chipidea/host.h:23:13: warning: 'ci_hdrc_host_driver_init' defined but not used [-Wunused-function] static void ci_hdrc_host_driver_init(void) ^ CC drivers/usb/chipidea/otg_fsm.o In file included from drivers/usb/chipidea/otg_fsm.c:34:0: drivers/usb/chipidea/host.h:23:13: warning: 'ci_hdrc_host_driver_init' defined but not used [-Wunused-function] static void ci_hdrc_host_driver_init(void) ^ Signed-off-by: Li Jun <jun.li@nxp.com>
2016-05-16MLK-12731-1 usb: chipidea: imx: add missing HSIC initialization for imx6qdl/slPeter Chen
This piece of code is existed at imx_3.10, but missing at imx_3.14 and imx_4.1, port it from imx_3.10. Signed-off-by: Peter Chen <peter.chen@nxp.com> (cherry picked from commit 901f278a08baf6e5109bcf538f1f78cdbbccd389)
2016-03-17usb: chipidea: add system interface for ttctrl.tthaPeter Chen
In chipidea IP RTL, there is a very limited design for siTD, the detail like below: There is no Max Packet Size at siTD, so it uses one constant for both Max Packet Size for packet and the packet size for the last transaction when considering schedule. If the ttctrl.ttha does not match against Hub Address field in siTD, this constant is 188 bytes, else this constant is 1023 bytes. If the ttctrl.ttha is non-zero value, RTL will use 188 as this constant, so it will lose the data if the packet size is larger than 188 bytes, eg, if we playback a wav which format is 48khz, 16 bits, 2 channels, the packet size will be 192bytes, but the controller will only send 188 bytes for this packet, the noise will be heared using USB audio card. The use case is single transaction, but higher frame rate. If the ttctr.ttha is zero value, we can send 1023 bytes within one transaction, but the controller will not accept the coming tranaction if it considers the schedule time is less than 1023 bytes. So the limitation is we can't schedule as many as transactions within frame. If the total bytes is already 256 bytes for previous transactions within frame, it can't accept another transaction. The use case is multiple transactions, but less frame rate. Signed-off-by: Peter Chen <peter.chen@kernel.org> Signed-off-by: Peter Chen <peter.chen@nxp.com> (cherry picked from commit 5e07ea7f812f2216263da2acd4f5e677de97fd62)
2016-03-17Revert "usb: chipidea: imx: enable CI_HDRC_SET_NON_ZERO_TTHA"Peter Chen
This reverts commit e765bfb73ff7. In the most of cases, we only use one transaction per frame and the frame rate may be high, If the platforms want to support multiple transactions but less frame rate cases like [1] and [2], it can set "non-zero-ttctrl-ttha" at dts. [1] http://www.spinics.net/lists/linux-usb/msg123125.html [2] http://www.spinics.net/lists/linux-usb/msg118679.html Signed-off-by: Peter Chen <peter.chen@kernel.org> Signed-off-by: Peter Chen <peter.chen@nxp.com> (cherry picked from commit 9e1a14ec6dfe34ae92e9754bbb1a5c470acbcdf1)
2016-02-16MLK-12344-3 usb: chipidea: update power lost handling for gadgetLi Jun
After we put gadget disconnect and connect in id switch handling, update power lost work accordingly. Acked-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Li Jun <jun.li@nxp.com>
2016-02-16MLK-12344-2 usb: chipidea: otg: add vbus disconnect for gadget after sleepLi Jun
During system sleep, if we switch otg role from gadget to host, and host vbus is directly controlled by ID signal, we will lose vbus drop event after resume because the vbus is on both at system suspend and resume, so we will miss gadget disconnect handling before start host role. This patch is to fix it by adding gadget disconnect for this case. Acked-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Li Jun <jun.li@nxp.com>
2016-02-16MLK-12344-1 usb: chipidea: otg: add vbus connect for gadget after sleepLi Jun
During system sleep, if we switch otg role from host to gadget, because the vbus is on both at system suspend and resume, we will lose vbus connect event after system resume, thus, no chance to setup vbus session for gadget so enumeration will not happen. This patch is to fix it by adding vbus connect handling for this case. Acked-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Li Jun <jun.li@nxp.com>
2016-01-21MLK-11896-9 usb: chipidea: udc: remove unused value assignmentLi Jun
Fix coverity CID 17293 unused value, retval is assigned to be -EOVERFLOW but is overwritten later before it can be used. Signed-off-by: Li Jun <jun.li@nxp.com>
2016-01-21MLK-11896-8 usb: phy: mxs: declar variable with initialized valueLi Jun
Fix coverity CID 17601 uninitialized scalar variable: vbus_value. Signed-off-by: Li Jun <jun.li@nxp.com>
2016-01-19MLK-12268 usb: gadget: fsl_utp: change FSL_UTP Kconfig locationLi Jun
Move FSL_UTP to be under USB_MASS_STORAGE since it depends on it. Signed-off-by: Li Jun <jun.li@nxp.com>
2016-01-15MLK-12247 usb: chipidea: udc: disconnect host if system enters suspendPeter Chen
It is better we disconnect (pulldown dp) host when the system enters suspend if the host did not suspend bus beforehand, it can avoid unnecessary udc suspend irq during usb enters suspend. This unexpected suspend irq occurs due to the udc still pulls up dp, but the host suspends bus due to it finds the device has disconnected. The device turns off high speed terminal will be considered a disconnection event from the host. It also fixes the bug ENGR00325724 describes. Signed-off-by: Peter Chen <peter.chen@freescale.com> (cherry picked from commit 9d9ddd142cdbfb4bcbaae161a452596668441b1a)
2016-01-14usb: gadget: udc-core: independent registration of gadgets and gadget driversRuslan Bilovol
Change behavior during registration of gadgets and gadget drivers in udc-core. Instead of previous approach when for successful probe of usb gadget driver at least one usb gadget should be already registered use another one where gadget drivers and gadgets can be registered in udc-core independently. Independent registration of gadgets and gadget drivers is useful for built-in into kernel gadget and gadget driver case - because it's possible that gadget is really probed only on late_init stage (due to deferred probe) whereas gadget driver's probe is silently failed on module_init stage due to no any UDC added. Also it is useful for modules case - now there is no difference what module to insert first: gadget module or gadget driver one. Tested-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> [simplified code as requested by Alan Stern and Felipe Balbi, fixed checkpatch issues] Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2016-01-14usb: gadget: udc-core: remove unused usb_udc_attach_driver()Ruslan Bilovol
Now when last user of usb_udc_attach_driver() is switched to passing UDC name via usb_gadget_driver struct, it's safe to remove this function Tested-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2016-01-14usb: gadget: configfs: pass UDC name via usb_gadget_driver structRuslan Bilovol
Now when udc-core supports binding to specific UDC by passing its name via 'udc_name' member of usb_gadget_driver struct, switch to this generic approach. Tested-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> [rebased and fixed checkpatch issues] Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2016-01-14usb: gadget: bind UDC by name passed via usb_gadget_driver structureRuslan Bilovol
Introduce new 'udc_name' member to usb_gadget_driver structure. The 'udc_name' is a name of UDC that usb_gadget_driver should be bound to. If udc_name is NULL, it will be bound to any available UDC. Tested-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2016-01-14MLK-11896-3 usb: chipidea: imx: add NULL check for usbmisc_dataLi Jun
Check if data->usbmisc_data is NULL before dereference it in probe. Acked-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Li Jun <jun.li@freescale.com>
2016-01-14MLK-11896-2 usb: chipidea: imx: derefence pointer after NULL checkLi Jun
Dereference data pointer after its NULL check. Signed-off-by: Li Jun <jun.li@freescale.com>
2016-01-14MLK-11896-1 usb: chipidea: imx: add break for switch caseLi Jun
Fix the coverity check complains although there is no function issue with current code. Signed-off-by: Li Jun <jun.li@freescale.com>
2016-01-14MLK-11891-2 usb: chipidea: usb kmalloc for HNP polling request flag bufferLi Jun
Use devm_kzalloc for DMA buffer of host request flag transfer when init otg fsm. Signed-off-by: Li Jun <jun.li@freescale.com>
2016-01-14MLK-11891-1 usb: otg-fsm: allocate DMA buffer for host request flag separatelyLi Jun
HNP polling need a one byte buffer for usb control transfer via DMA read, currently using a data field in a structure for DMA buffer may cause cache incoherent issue, because the cache line for the DMA buffer also contains other data in this structure, while dma from device is outstanding, the access on other data in the same cache line will cause we get the old data before DMA. This patch change the host_request_flag to be a pointer, its memory will be allocated through kmalloc by controller driver, with this way, the DMA buffer can be properly aligned and padded. Signed-off-by: Li Jun <jun.li@freescale.com>
2016-01-14MLK-11870 usb: chipidea: otg: disable term select override for B deviceLi Jun
In MLK-11272, we introduce a workaround to resolve data pulse detection IC issue in i.MX7D, but did not disable the term select override after the A device becomes B device in some cases: a_idle --> enable term select override --> b_idle, which cause the B device cannot be enumerated in b_peripheral mode. This patch is to fix it by disable the term select and data pulse when A device becomes B device. Signed-off-by: Li Jun <jun.li@freescale.com> (cherry picked from commit 2df52fcaded838a572c2ee8f93d6cc827a2ebc60)
2016-01-14MLK-11831-2 usb: chipidea: imx: add request{release}_bus_freqPeter Chen
When the usb in idle, it calls release_bus_req. When the usb is going to use, it calls request_bus_req. This is a rework patch of ENGR00286459 and ENGR00286926. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Li Jun <jun.li@freescale.com>
2016-01-14MLK-11831-1 usb: chipidea: imx: Add dummy LDO2p5 regulator for VBUS wakeupRanjani Vaidyanathan
LDO2p5 cannot be disabled in low power idle mode when the USB driver enables VBUS wakeup. To identify when LDO2p5 can be disabled add a dummy regulator that the USB driver will enable when VBUS wakeup is required. Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com> Signed-off-by: Li Jun <jun.li@freescale.com>
2016-01-14MLK-11802-1 usb: chipidea: ci_hdrc_imx: not CI_HDRC_DISABLE_HOST_STREAMING ↵Peter Chen
for imx6ul i.mx6UL uses chipidea v2.5a core, it does not have the bug (see 3bdfc2609b621c57355024005031acb94eabb8fc) which needs to disable stream mode to work around. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2016-01-14usb: chipidea: debug: disable usb irq while role switchLi Jun
Since the ci->role will be set after the host role start is complete, there will be nobody cared irq during start host if usb irq enabled. This error can be reproduced on i.mx6 sololite EVK board by: 1. disable otg id irq(IDIE) and disable all real otg properties of usbotg1 in dts. 2. boot up the board with ID cable and usb device connected. 3. echo gadget > /sys/kernel/debug/ci_hdrc.0/role 4. echo host > /sys/kernel/debug/ci_hdrc.0/role 5. irq 212: nobody cared. Cc: <stable@vger.kernel.org> # v3.10+ Signed-off-by: Li Jun <jun.li@freescale.com> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Peter Chen <peter.chen@kernel.org>
2016-01-14usb: chipidea: delete static debug supportPeter Chen
Since we have dynamic debug support, delete static debug for chipidea Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Peter Chen <peter.chen@kernel.org>
2016-01-14usb: chipidea: support debugfs without CONFIG_USB_CHIPIDEA_DEBUGPeter Chen
Since we need to mount debugfs to show/store the things we want to debug, it is duplicated to add another configuration to enable it. Meanwhile, with CONFIG_USB_CHIPIDEA_DEBUG, we can't support chipidea debugfs at runtime. Signed-off-by: Peter Chen <peter.chen@freescale.com> Cc: Jun Li <jun.li@freescale.com> Signed-off-by: Peter Chen <peter.chen@kernel.org>
2016-01-14usb: chipidea: udc: improve error handling on _hardware_enqueueFelipe F. Tonello
_hardware_enqueue() didn't check for errors when using add_td_to_list() which can fail if dma_pool_alloc fails, thus causing a kernel panic when lastnode->ptr is NULL. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Peter Chen <peter.chen@freescale.com>
2016-01-14usb: chipidea: udc: _ep_queue and _hw_queue cleanupFelipe F. Tonello
Update comments to reflect current state of functions. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Peter Chen <peter.chen@freescale.com>
2016-01-14usb: chipidea: otg: don't wait vbus drops below BSV when starts hostLi Jun
Some HW design may use ID pin state to control vbus for otg port, so before host role start, the vbus is already turned on, in this case, we do not need wait vbus dropping below BSV. Signed-off-by: Li Jun <jun.li@freescale.com> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Peter Chen <peter.chen@kernel.org>
2016-01-14chipidea: ci_hdrc_pci: use PCI_VDEVICE() instead of PCI_DEVICE()Sergei Shtylyov
Fix using the PCI_DEVICE() macro instead of less verbose PCI_VDEVICE(). Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Peter Chen <peter.chen@freescale.com>
2016-01-14usb: chipidea: add xilinx zynq platform dataNathan Sullivan
Due to having hardware tx buffers less than 512 bytes in size, streaming must be enabled on the Zynq for the udc to work at all. Add platform data specific to the Zynq udc, which does not set the CI_HDRC_DISABLE_STREAMING flag. Based on a patch by the same name from the Xilinx vendor tree. Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com> Signed-off-by: Peter Chen <peter.chen@freescale.com>
2016-01-14usb: misc: usbtest: add bulk queue testPeter Chen
The bulk queue tests are used to show 'best performance' for bulk transfer, we are often asked this question by users. The implementation is the same with iso test, that is queue request at interrupt completion, so we reuse the iso structures, and rename them as common one. It's result should be very close to IC simulation, in order to get that, the device side should also need to prepare enough queue. We have got the 'best performance' (IN: 41MB, OUT: 39MB) at i.mx platform (USB2, ARM Cortex A9, stream mode need to enable) with below command: Host side: modprobe usbtest ./testusb -a -t 27 -g 64 -s 16384 ./testusb -a -t 28 -g 64 -s 16384 Gadget side: modprobe g_zero loopdefault=1 qlen=64 buflen=16384 Signed-off-by: Peter Chen <peter.chen@freescale.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <balbi@ti.com>
2016-01-14usb: misc: usbtest: format the data pattern according to max packet sizeAlan Stern
With this change, the host and gadget doesn't need to agree with transfer length for comparing the data, since they doesn't know each other's transfer size, but know max packet size. Signed-off-by: Peter Chen <peter.chen@freescale.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> (Fixed the 'line over 80 characters warning' by Peter Chen) Tested-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <balbi@ti.com>
2016-01-14usb: gadget: f_sourcesink: format data pattern according to max packet sizePeter Chen
Since the host and gadget can't agree with transfer length before each transfer, but they agree with max packet size for each endpoint, we use max packet size to format data pattern. Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2016-01-14usb: misc: usbtest: using the same data format among write/compare/outputPeter Chen
Using the same data format "buf[j] = (u8)(i + j)" among write, compare buf, and console output stage. Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2016-01-14usb: misc: usbtest: delete useless memset for urbs arrayPeter Chen
The element of urbs array will be initialized at below code at once. for (i = 0; i < param->sglen; i++) { urbs[i] = iso_alloc_urb(udev, pipe, desc, param->length, offset); Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2016-01-14usb: misc: usbtest: allocate size of urb array according to user parameterPeter Chen
Allocate the size of urb pointer array according to testusb's parameter sglen, and limits the length of sglen as MAX_SGLEN (128 currently). Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2016-01-14usb: misc: usbtest: format max packet size for iso transferPeter Chen
The current code prints all wMaxPacketSize content at endpoint descriptor, if there is a high speed, high bandwidth endpoint, it may confuse the users, eg, if there are 3 transactions during microframe, it will print "wMaxPacket 1400" for packet content. This commit splits wMaxpacketSize and transaction numbers for output messages. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-14MLK-11483-4 UTP : replace kzalloc() with vmalloc()Huang Shijie
When allocating large memory, such as 128K, vmalloc() uses single page for the allocation process, while kzalloc() has to consume a continuous pages for the allocation. In low memory case, the kzalloc() may fails. So use the vmalloc() instead. Also add some sanity check for the NULL pointer. Add missed line for ENGR00161643-3 UTP : bugfix Signed-off-by: Huang Shijie <b32955@freescale.com>
2016-01-14MLK-11483-3 mfg: fix the bug that ubiformat utility breaks utp protocolPeter Chen
ubiformat includes command, data, command periods, it breaks utp protocol for PUT commands. So we add two operations to fix it. One is sending busy to host before the data periods begins. The second is adding a new command to waiting ubiformat's command period. Signed-off-by: Li Xingyu <b02754@freescale.com> Signed-off-by: Peter Chen <peter.chen@freescale.com>
2016-01-14MLK-11483-2 mfgtool firmware will crash during mfgtool runningTony LIU
- the root cause of this issue is there is no protection for the resource which will be accessed by multiple thread Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2016-01-14MLK-11483-1 make the kernel image for mfgtoolFrank Li
uboot needs pass down below parameters removable = 1 stall = 0 idVendor = 0x066F idProduct = 0x37FF iSerialNumber = "" sleep_thread add new parameter Signed-off-by: Lu Lin <b37454@freescale.com> Signed-off-by: Frank Li<frank.li@freescale.com>
2016-01-14MLK-10783-4 usb: chipidea: imx: Enable usb function at imx6ulPeter Chen
Enable USB function at imx6ul Signed-off-by: Peter Chen <peter.chen@freescale.com> (cherry picked from commit 54780f0a5998af69c4e20ebb13088f3ac3e7a79a)
2016-01-14MLK-10174-2 usb: chipidea: host: keep controller power if host has dev connectedLi Jun
This patch is to keep usb controller power on while system suspend if there is usb device connected by telling GPC to keep mega fast domain power. Signed-off-by: Li Jun <jun.li@freescale.com> (cherry picked from commit 74d1524208bfa052f9adac28c8f7d8fb8ed78499)
2016-01-14MLK-11340-43 usb: chipidea: imx: fix usb charger detection init NULL pointerLi Jun
Dereference the charger->psy after the power_supply is created to fix the null pointer issue. Signed-off-by: Li Jun <b47624@freescale.com>