summaryrefslogtreecommitdiff
path: root/drivers/usb/chipidea/core.c
AgeCommit message (Collapse)Author
2019-09-13usb: chipidea: use seperate role sm when using extconMax Krummenacher
Enable the code from commit 'aa5fc842bb05 usb: chipidea: use of extcon framework to work for non OTG case' if ID and/or VBUS signals are taken from extcon. Otherwise (observed on a Colibri iMX6ULL) when booting in the ROLE_HOST and then changing to ROLE_GADGET the gadget does not appear on the bus and switching back to ROLE_HOST does also no longer detect any connected USB devices. Related-to: #50573 Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> (cherry picked from commit b80233b2f3ec91920bba3712dcc929dc913caf15)
2019-05-24usb: chipidea: use of extcon framework to work for non OTG caseStefan Agner
The existing usage of extcon in chipidea driver freezes the kernel presumably due to OTGSC register access. Prevent accessing any OTG registers for SoC with dual role devices but no true OTG support. Use the flag CI_HDRC_DUAL_ROLE_NOT_OTG for those devices and in case extcon is present, do the role switch using extcon only. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Stefan Agner <stefan.agner@toradex.com> (cherry picked from commit 28291538966f8828be6d9e86d72cb3ea9ada28f1) [rebased ontop of 4.9] Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> (cherry picked from commit 241a15ed4b8ebd49de06b7ce7e13db213d3bdee6) 4.14: follow changed extcon_get_cable_state_() -> extcon_get_state_() Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 452e295bf2537781813d7b9bdf4ae5abad622ce9)
2019-05-08Merge branch 'linux-4.14.y_for_4.14-2.0.x-imx' into 4.14-2.0.x-imxPhilippe Schenker
2019-04-05usb: chipidea: Grab the (legacy) USB PHY by phandle firstPaul Kocialkowski
[ Upstream commit 68ef236274793066b9ba3154b16c0acc1c891e5c ] According to the chipidea driver bindings, the USB PHY is specified via the "phys" phandle node. However, this only takes effect for USB PHYs that use the common PHY framework. For legacy USB PHYs, a simple lookup based on the USB PHY type is done instead. This does not play out well when more than one USB PHY is registered, since the first registered PHY matching the type will always be returned regardless of what the driver was bound to. Fix this by looking up the PHY based on the "phys" phandle node. Although generic PHYs are rather matched by their "phys-name" and not the "phys" phandle directly, there is no helper for similar lookup on legacy PHYs and it's probably not worth the effort to add it. When no legacy USB PHY is found by phandle, fallback to grabbing any registered USB2 PHY. This ensures backward compatibility if some users were actually relying on this mechanism. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-12MLK-20346 usb: chipidea: change power_lost workqueue as freezablePeter Chen
Like commit d144dfea8af7 ("usb: chipidea: otg: change workqueue ci_otg as freezable"), the power_lost work item may try to remove hcd if controller is powered off during the system suspend, and the similar deadlock happens, see below dumps. Meanwhile, with this change, we need to disable USB interrupt during the work item runs (after driver resume has finished), otherwise, USB transfer will be timeout (5s) due to USB interrupt is disabled and IAA watchdog is still not ready at that time. Workqueue: events ci_power_lost_work Call trace: [<ffff000008085c44>] __switch_to+0x8c/0xd0 [<ffff000008d7bbf4>] __schedule+0x19c/0x5d8 [<ffff000008d7c068>] schedule+0x38/0xa0 [<ffff000008d7f3b4>] schedule_timeout+0x19c/0x338 [<ffff000008d7cc10>] wait_for_common+0xa0/0x148 [<ffff000008d7cccc>] wait_for_completion+0x14/0x20 [<ffff0000080e6040>] flush_work+0xd8/0x1f0 [<ffff0000080e61f4>] flush_delayed_work+0x3c/0x48 [<ffff0000081ae1c8>] wb_shutdown+0x90/0xd0 [<ffff0000081ae688>] bdi_unregister+0x58/0x1c0 [<ffff000008413a60>] del_gendisk+0x218/0x228 [<ffff00000871683c>] sd_remove+0x64/0xc0 [<ffff0000086b6eec>] device_release_driver_internal+0x154/0x1f0 [<ffff0000086b6f9c>] device_release_driver+0x14/0x20 [<ffff0000086b5d40>] bus_remove_device+0xc8/0x108 [<ffff0000086b2a08>] device_del+0x1f8/0x300 [<ffff0000087049ec>] __scsi_remove_device+0xec/0x128 [<ffff000008702c70>] scsi_forget_host+0x70/0x78 [<ffff0000086f7ee8>] scsi_remove_host+0xa0/0x140 [<ffff0000088e0588>] usb_stor_disconnect+0x50/0xc0 [<ffff00000887eab8>] usb_unbind_interface+0x78/0x280 [<ffff0000086b6eec>] device_release_driver_internal+0x154/0x1f0 [<ffff0000086b6f9c>] device_release_driver+0x14/0x20 [<ffff0000086b5d40>] bus_remove_device+0xc8/0x108 [<ffff0000086b2a08>] device_del+0x1f8/0x300 [<ffff00000887c364>] usb_disable_device+0xa4/0x210 [<ffff000008872cfc>] usb_disconnect+0x7c/0x240 [<ffff000008872e40>] usb_disconnect+0x1c0/0x240 [<ffff000008878e10>] usb_remove_hcd+0xc0/0x1d8 [<ffff0000088e7bac>] host_stop+0x34/0x90 [<ffff0000088e4088>] ci_handle_id_switch+0x70/0x1d0 [<ffff0000088e3038>] ci_power_lost_work+0x90/0xa8 [<ffff0000080e7100>] process_one_work+0x1e0/0x340 [<ffff0000080e72b0>] worker_thread+0x50/0x458 [<ffff0000080ed32c>] kthread+0xfc/0x128 [<ffff000008084eb8>] ret_from_fork+0x10/0x18 Reviewed-by: Jun Li <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-02-12MLK-20011-2 usb: chipidea: delete DP pullup for secondary charger detectionPeter Chen
Since the DP pullup can be finished at glue layer, we can delete it at common code, but we still need to keep DP pulldown operation since the DP may have already pulled up before. Reviewed-by: Jun Li <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-02-12MLK-19850-6 usb: chipidea: introduce flag for enable USB PHY charger detectionPeter Chen
Some platforms may want to use USB PHY charger detection function when VBUS is there, add one flag for it. The user can enable it at firmware. Reviewed-by: Jun Li <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-02-12MLK-16532 usb: chipidea: do not call WARN_ON if controller is going to ↵Peter Chen
suspend twice At current PM framework, the dev->runtime_suspend may be called after dev->system_suspend is called, and the dev->runtime_resume may be called before dev->system_suspend is called. So, we need to delete WARN_ON to avoid before dump: [ 466.712978] [<ffff200008c49cdc>] ci_hdrc_imx_runtime_suspend+0x2c/0xa8 [ 466.719619] [<ffff2000088c29e8>] pm_generic_runtime_suspend+0x48/0x68 [ 466.726168] [<ffff2000088d4f04>] genpd_runtime_suspend+0xcc/0x300 [ 466.732372] [<ffff2000088c7068>] pm_runtime_force_suspend+0x48/0xa8 [ 466.738748] [<ffff2000088d5330>] pm_genpd_suspend_noirq+0xa0/0x118 [ 466.745032] [<ffff2000088c86ec>] dpm_run_callback+0x4c/0xc0 [ 466.750709] [<ffff2000088c941c>] __device_suspend_noirq+0x194/0x3d0 [ 466.757080] [<ffff2000088cb460>] dpm_suspend_noirq+0x188/0x328 [ 466.763024] [<ffff200008143218>] suspend_devices_and_enter+0x230/0x650 [ 466.769655] [<ffff200008143990>] pm_suspend+0x358/0x3d0 [ 466.774984] [<ffff200008141f0c>] state_store+0x8c/0x100 [ 466.780321] [<ffff20000857a83c>] kobj_attr_store+0x44/0x60 [ 466.785915] [<ffff2000083436a8>] sysfs_kf_write+0x98/0xb0 [ 466.791419] [<ffff200008342118>] kernfs_fop_write+0x120/0x288 [ 466.797276] [<ffff20000828d518>] __vfs_write+0xc0/0x238 [ 466.802604] [<ffff20000828e900>] vfs_write+0xc8/0x248 [ 466.807764] [<ffff200008290678>] SyS_write+0xa0/0x110 [ 466.812919] [<ffff20000808374c>] __sys_trace_return+0x0/0x4 BuildInfo: - SCFW 1f59442e, IMX-MKIMAGE fb52c576, ATF - U-Boot 2017.03-imx_v2017.03+g34be5a2 Cc: Anson Huang <anson.huang@nxp.com> Acked-by: Jun Li <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-02-12MLK-14396 usb: chipidea: add mutex for concurrent runningPeter Chen
The ci_handle_id_switch is called at two places, at very rare situations, it may be running at the same time. Eg, when the system is back from the resume, the id event is occurred from extcon driver, as well as power_lost work item is called due to the controller is poweroff at the suspend. Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-02-12MLK-15032-3 usb: chipidea: core: remove the extcon change for imx_4.1.yLi Jun
commit 916e43e1d6fb ("MLK-13570-3 usb: chipidea: core: change extcon usage for imx_4.1.y") is directly cherry-picked from 4.1.y, but which is not valid anymore on 4.y kernel, so revert most part and only keep the irq check after resume. Reviewed-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Li Jun <jun.li@nxp.com>
2019-02-12MLK-13570-3 usb: chipidea: core: change extcon usage for imx_4.1.yPeter Chen
At v4.1 kernel, we can't get cable type at notifier, but at extcon-usb-gpio.c notifies both VBUS and ID event, we had to do special handling for ID event, and omit VBUS event. Current implementation only supports ID extcon event. If wakeup event occurs by extcon, it needs to call ci_irq again since the first ci_irq calling at extcon notifier only wakes up controller, but do noop for event handling. Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-02-12MLK-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> (cherry picked from commit fd49596eceeb4e61267f35fb74bf0c04056f2ed7)
2019-02-12MLK-10750 usb: chipidea: otg: remove otg fsm before destory gdaget and hostLi Jun
If unload ci_hdrc driver while otg fsm is running as A-device, we should firstly clean otg fsm and stop all otg fsm timers before destroy gadget and host. Signed-off-by: Li Jun <jun.li@freescale.com>
2019-02-12MLK-11340-41 usb: chipidea: add vbus glitch handlingLi Jun
We add vbus glitch handling for both BSV rise and drop interruptes. This patch changes covers usb otg certification case, so the possible cases of vbus rise: - USB vbus can reach AVV(4.4v), valid vbus. - USB vbus keeps above BSV(0.8v) but lower than AVV(4.4v) for more than 300ms, we think it's valid vbus event, this can meet usb otg certificataion case(B device can do connection in 1s when vbus is 4.0v). - USB vbus cannot be kept above BSV(0.8v) for more than 300ms, it's a vbus glitch. In case of vbus drop: if the vbus on flag is not set, it's a vbus glitch, otherwise it's a valid vbus drop event. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Li Jun <b47624@freescale.com> During 4.14 rebase this was squashed from 2 commits: commit c133d378ab68 ("MLK-11340-41 usb: chipidea: add vbus glitch handling") commit 2d0f6361ceef ("MLK-11340-42 usb: chipidea: usb vbus glitch check logic change") The first patch used a hw_wait_reg that was deleted from upstream long ago and the second patch removed it. Generate a single commit instead. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-02-12MLK-11340-37 usb: chipidea: add query_available_role interfacePeter Chen
The glue layer may need to know current available role, add ci_hdrc_query_available_role for that. Signed-off-by: Peter Chen <peter.chen@freescale.com> (cherry picked from commit 5c340402131ca6eacaeb122deb1ee59bcea2778c)
2019-02-12MLK-9618-7 usb: chipidea: otg: delay turn on vbus when detecting data pulseLi Jun
This patch adds a timer to delay turn on vbus after detecting data pulse from B-device, this is required by OTG SRP timing. Signed-off-by: Li Jun <b47624@freescale.com> (cherry picked from commit f02ee3e93715c41f5b1e11140f36e350c7ed4d6b)
2019-02-12MLK-10102-10 usb: chipidea: otg: Add power lost support for otg fsm modeLi Jun
This patch adds support of power lost during system sleep in otg fsm mode. Signed-off-by: Li Jun <b47624@freescale.com> (cherry picked from commit 493f3c4f04f48240dacc49f84db57e7ecf90161b)
2019-02-12MLK-10102-8 usb: chipidea: support role change after power lostLi Jun
This patch is to complete support usb resume from power lost in non-otg fsm mode: - Re-init usb phy. - Support role changes during system sleep with power lost. Acked-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Li Jun <b47624@freescale.com>
2019-02-12MLK-10102-3 usb: chipidea: export hw_controller_reset APILi Jun
Host needs to reset controller for recovery from power lost. Signed-off-by: Peter Chen <peter.chen@freescale.com> (cherry picked from commit 136222e683d40890f11985e61b447f2481b8bff5)
2019-02-12MLK-10102-2 usb: chipidea: add suspend and resume routine for role driverLi Jun
We may need to do extra things for system suspend/resume per different roles(e.g. power lost during system sleep), so define system suspend/resume handler for roles. Signed-off-by: Peter Chen <peter.chen@freescale.com> (cherry picked from commit cac6f339b30102c63f8bb5c56e77d5c7a6c6b4b5)
2019-02-12MLK-10085-5 usb: chipidea: Add usb charger detect notifyLi Jun
- Change .notify's return value from void to int, update msm notify_event return value accordingly. - Add CI_HDRC_CONTROLLER_VBUS_EVENT and CI_HDRC_CONTROLLER_CHARGER_POST_EVENT to finish the USB charger detection flow. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Li Jun <jun.li@freescale.com>
2017-08-28Merge tag 'usb-ci-v4.14-rc1' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next Peter writes: Chipidea changes for v4.14-rc1 - Add chipidea support at Nvidia SoCs - Improvement for extcon support - Some code refines
2017-08-10usb: chipidea: constify attribute_group structures.Arvind Yadav
attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-25usb: chipidea: core: do not register extcon notifier if extcon device is not ↵Peter Chen
existed This issue is detected when the system has another device driver which registers USB connector extcon device, fix it by adding extcon device check. Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-06-27Merge tag 'usb-ci-v4.13-rc1' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next Peter writes: One patch to improve error handling at chipidea core
2017-05-23usb: chipidea: core: check before accessing ci_role in ci_role_showMichael Thalmeier
ci_role BUGs when the role is >= CI_ROLE_END. This is the case while the role is changing. Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-05-18usb: chipidea: properly handle host or gadget initialization failureJisheng Zhang
If ci_hdrc_host_init() or ci_hdrc_gadget_init() returns error and the error != -ENXIO, as Peter pointed out, "it stands for initialization for host or gadget has failed", so we'd better return failure rather continue. And before destroying the otg, i.e ci_hdrc_otg_destroy(ci), we should also check ci->roles[CI_ROLE_GADGET]. Signed-off-by: Jisheng Zhang <jszhang@marvell.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-04-18Merge tag 'usb-ci-v4.12-rc1' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next Peter writes: Two changes for this v4.12-rc1: - Add sysfs entry for role switch - Update gadget state after gadget back from suspend
2017-04-14usb: chipidea: core: add sysfs groupPeter Chen
Sometimes, the user needs to adjust some properties for controllers, eg the role for controller, we add sysfs group for them. The attribute 'role' is used to switch host/gadget role dynamically, the uewr can read the current role, and write the other role compare to current one to finish the switch. Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-03-23usb: chipidea: use bus->sysdev for DMA configurationArnd Bergmann
Set the dma for chipidea from sysdev. This is inherited from its parent node. Also, do not set dma mask for child as it is not required now. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sriram Dash <sriram.dash@nxp.com> Acked-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: chipidea: Configure phy for appropriate modeStephen Boyd
When the qcom chipidea controller is used with an extcon, we need to signal device mode or host mode to the phy so it can configure itself for the correct mode. This should be done after the phy is powered up, so that the register writes work correctly. Add in the appropriate phy_set_mode() call here. Cc: Peter Chen <peter.chen@nxp.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-23usb: chipidea: delete an useless header includeJisheng Zhang
<linux/phy.h> is for net phy drivers, we don't need it. Signed-off-by: Jisheng Zhang <jszhang@marvell.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20usb: chipidea: msm: Handle phy power statesStephen Boyd
The ULPI phy on qcom platforms needs to be initialized and powered on after a USB reset and before we toggle the run/stop bit. Otherwise, the phy locks up and doesn't work properly. Hook the phy initialization into the RESET event and the phy power off into the STOPPED event. Acked-by: Peter Chen <peter.chen@nxp.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20usb: chipidea: Consolidate extcon notifiersStephen Boyd
The two extcon notifiers are almost the same except for the variable name for the cable structure and the id notifier inverts the cable->state logic. Make it the same and replace two functions with one to save some lines. This also makes it so that the id cable state is true when the id pin is pulled low, so we change the name of ->state to ->connected to properly reflect that we're interested in the cable being connected. Acked-by: Peter Chen <peter.chen@nxp.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Ivan T. Ivanov" <iivanov.xz@gmail.com> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20usb: chipidea: Add support for ULPI PHY busStephen Boyd
Some phys for the chipidea controller are controlled via the ULPI viewport. Add support for the ULPI bus so that these sorts of phys can be probed and read/written automatically without having to duplicate the viewport logic in each phy driver. Acked-by: Peter Chen <peter.chen@nxp.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20usb: chipidea: Add platform flag for wrapper phy managementStephen Boyd
The ULPI phy on qcom platforms needs to be initialized and powered on after a USB reset and before we toggle the run/stop bit. Otherwise, the phy locks up and doesn't work properly. Therefore, add a flag to skip any phy power management in the core layer, leaving it up to the glue driver to manage. Acked-by: Peter Chen <peter.chen@nxp.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20usb: chipidea: Only read/write OTGSC from one placeStephen Boyd
With the id and vbus detection done via extcon we need to make sure we poll the status of OTGSC properly by considering what the extcon is saying, and not just what the register is saying. Let's move this hw_wait_reg() function to the only place it's used and simplify it for polling the OTGSC register. Then we can make certain we only use the hw_read_otgsc() API to read OTGSC, which will make sure we properly handle extcon events. Acked-by: Peter Chen <peter.chen@nxp.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Ivan T. Ivanov" <iivanov.xz@gmail.com> Fixes: 3ecb3e09b042 ("usb: chipidea: Use extcon framework for VBUS and ID detect") Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20usb: chipdata: Replace the extcon APIChanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier() and replaces the deprecated extcon API as following: - extcon_get_cable_state_() -> extcon_get_state() Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
2016-11-15usb: chipidea: move the lock initialization to core filePeter Chen
This can fix below dump when the lock is accessed at host mode due to it is not initialized. [ 46.119638] INFO: trying to register non-static key. [ 46.124643] the code is fine but needs lockdep annotation. [ 46.130144] turning off the locking correctness validator. [ 46.135659] CPU: 0 PID: 690 Comm: cat Not tainted 4.9.0-rc3-00079-g4b75f1d #1210 [ 46.143075] Hardware name: Freescale i.MX6 SoloX (Device Tree) [ 46.148923] Backtrace: [ 46.151448] [<c010c460>] (dump_backtrace) from [<c010c658>] (show_stack+0x18/0x1c) [ 46.159038] r7:edf52000 [ 46.161412] r6:60000193 [ 46.163967] r5:00000000 [ 46.165035] r4:c0e25c2c [ 46.169109] [<c010c640>] (show_stack) from [<c03f58a4>] (dump_stack+0xb4/0xe8) [ 46.176362] [<c03f57f0>] (dump_stack) from [<c016d690>] (register_lock_class+0x4fc/0x56c) [ 46.184554] r10:c0e25d24 [ 46.187014] r9:edf53e70 [ 46.189569] r8:c1642444 [ 46.190637] r7:ee9da024 [ 46.193191] r6:00000000 [ 46.194258] r5:00000000 [ 46.196812] r4:00000000 [ 46.199185] r3:00000001 [ 46.203259] [<c016d194>] (register_lock_class) from [<c0171294>] (__lock_acquire+0x80/0x10f0) [ 46.211797] r10:c0e25d24 [ 46.214257] r9:edf53e70 [ 46.216813] r8:ee9da024 [ 46.217880] r7:c1642444 [ 46.220435] r6:edcd1800 [ 46.221502] r5:60000193 [ 46.224057] r4:00000000 [ 46.227953] [<c0171214>] (__lock_acquire) from [<c01726c0>] (lock_acquire+0x74/0x94) [ 46.235710] r10:00000001 [ 46.238169] r9:edf53e70 [ 46.240723] r8:edf53f80 [ 46.241790] r7:00000001 [ 46.244344] r6:00000001 [ 46.245412] r5:60000193 [ 46.247966] r4:00000000 [ 46.251866] [<c017264c>] (lock_acquire) from [<c096c8fc>] (_raw_spin_lock_irqsave+0x40/0x54) [ 46.260319] r7:ee1c6a00 [ 46.262691] r6:c062a570 [ 46.265247] r5:20000113 [ 46.266314] r4:ee9da014 [ 46.270393] [<c096c8bc>] (_raw_spin_lock_irqsave) from [<c062a570>] (ci_port_test_show+0x2c/0x70) [ 46.279280] r6:eebd2000 [ 46.281652] r5:ee9da010 [ 46.284207] r4:ee9da014 [ 46.286810] [<c062a544>] (ci_port_test_show) from [<c0248d04>] (seq_read+0x1ac/0x4f8) [ 46.294655] r9:edf53e70 [ 46.297028] r8:edf53f80 [ 46.299583] r7:ee1c6a00 [ 46.300650] r6:00000001 [ 46.303205] r5:00000000 [ 46.304273] r4:eebd2000 [ 46.306850] [<c0248b58>] (seq_read) from [<c039e864>] (full_proxy_read+0x54/0x6c) [ 46.314348] r10:00000000 [ 46.316808] r9:c0a6ad30 [ 46.319363] r8:edf53f80 [ 46.320430] r7:00020000 [ 46.322986] r6:b6de3000 [ 46.324053] r5:ee1c6a00 [ 46.326607] r4:c0248b58 [ 46.330505] [<c039e810>] (full_proxy_read) from [<c021ec98>] (__vfs_read+0x34/0x118) [ 46.338262] r9:edf52000 [ 46.340635] r8:c0107fc4 [ 46.343190] r7:00020000 [ 46.344257] r6:edf53f80 [ 46.346812] r5:c039e810 [ 46.347879] r4:ee1c6a00 [ 46.350447] [<c021ec64>] (__vfs_read) from [<c021fbd0>] (vfs_read+0x8c/0x11c) [ 46.357597] r9:edf52000 [ 46.359969] r8:c0107fc4 [ 46.362524] r7:edf53f80 [ 46.363592] r6:b6de3000 [ 46.366147] r5:ee1c6a00 [ 46.367214] r4:00020000 [ 46.369782] [<c021fb44>] (vfs_read) from [<c0220a4c>] (SyS_read+0x4c/0xa8) [ 46.376672] r8:c0107fc4 [ 46.379045] r7:00020000 [ 46.381600] r6:b6de3000 [ 46.382667] r5:ee1c6a00 [ 46.385222] r4:ee1c6a00 [ 46.387817] [<c0220a00>] (SyS_read) from [<c0107e20>] (ret_fast_syscall+0x0/0x1c) [ 46.395314] r7:00000003 [ 46.397687] r6:b6de3000 [ 46.400243] r5:00020000 [ 46.401310] r4:00020000 Cc: <stable@vger.kernel.org> Fixes: 26c696c678c4 ("USB: Chipidea: rename struct ci13xxx variables from udc to ci") Signed-off-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-29usb: 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@nxp.com>
2015-12-24usb: chipidea: removing of_find_propertySaurabh Sengar
call to of_find_property() before of_property_read_u32() is unnecessary. of_property_read_u32() anyway calls to of_find_property() only. Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com> Signed-off-by: Peter Chen <peter.chen@freescale.com>
2015-12-24usb: chipidea: clean up CONFIG_USB_CHIPIDEA_DEBUG referencePeter Chen
Since this configuration option has deleted, cleans up all its references. Signed-off-by: Peter Chen <peter.chen@freescale.com> Reported-by: Valentin Rothberg <valentinrothberg@gmail.com>
2015-12-24usb: 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>
2015-10-22Merge tag 'usb-ci-v4.4-rc1' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next Peter writes: USB Chipidea updates for v4.4-rc1 - Use extcon framework for VBUS and ID detect - Add imx6sx and imx7d support - Other small changes
2015-10-22usb: chipidea: Add support for 'phy-clkgate-delay-us' propertyFabio Estevam
Add support for the optional 'phy-clkgate-delay-us' property that is used to describe the delay time between putting PHY into low power mode and turning off the PHY clock. Signed-off-by: Li Jun <jun.li@freescale.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Peter Chen <peter.chen@freescale.com>
2015-10-22usb: chipidea: Use extcon framework for VBUS and ID detectIvan T. Ivanov
On recent Qualcomm platforms VBUS and ID lines are not routed to USB PHY LINK controller. Use extcon framework to receive connect and disconnect ID and VBUS notification. Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org> Signed-off-by: Peter Chen <peter.chen@freescale.com>
2015-09-27usb: common: of_usb_get_dr_mode to usb_get_dr_modeHeikki Krogerus
By using the unified device property interface, the function can be made available for all platforms and not just the ones using DT. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27usb: common: of_usb_get_maximum_speed to usb_get_maximum_speedHeikki Krogerus
By using the unified device property interface, the function can be made available for all platforms and not just the ones using DT. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-14Merge tag 'usb-ci-v4.3-rc1' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next Peter writes: USB: chipidea updates for v4.3-rc1 The main changes are adding several system interfaces for tuning performance, and each vendors can adjust them according to their design configurations. Others are tiny improvements, like more well siTD supports, USB_DEVICE_A_HNP_SUPPORT supports, etc.
2015-08-14Merge tag 'usb-for-v4.3' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v4.3 merge window New support for Allwinne SoC on the MUSB driver has been added to the list of glue layers. MUSB also got support for building all DMA engines in one binary; this will be great for distros. DWC3 now has no trace of dev_dbg()/dev_vdbg() usage. We will rely solely on tracing to debug DWC3. There was also a fix for memory corruption with EP0 when maxpacket size transfers are > 512 bytes. Robert's EP capabilities flags is making EP selection a lot simpler. UDCs are now required to set these flags up when adding endpoints to the framework. Other than these, we have the usual set of miscelaneous cleanups and minor fixes. Signed-off-by: Felipe Balbi <balbi@ti.com>