aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/host
AgeCommit message (Collapse)Author
2013-04-17USB: ehci-omap: Improve PHY error handlingRoger Quadros
As the USB PHY layer never returns NULL we don't need to check for that condition. Signed-off-by: Roger Quadros <rogerq@ti.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-17USB: ehci-omap: Don't select any PHY driverRoger Quadros
Don't select NOP_USB_XCEIV. Instead, board config must select USB_PHY and the appropriate PHY driver. Also add a hint in Kconfig so that users enabling this driver manually enable the right PHY drivers as well. Gets rid of the below warnings when USB_EHCI_HCD_OMAP is enabled. warning: (USB_EHCI_HCD_OMAP) selects NOP_USB_XCEIV which has unmet direct dependencies (USB_SUPPORT && USB_PHY) warning: (USB_EHCI_HCD_OMAP) selects NOP_USB_XCEIV which has unmet direct dependencies (USB_SUPPORT && USB_PHY) Signed-off-by: Roger Quadros <rogerq@ti.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-17usb: remove redundant tdi_resetShengzhou Liu
We remove the redundant tdi_reset in ehci_setup since there is already it in ehci_reset. It was observed that the duplicated tdi_reset was causing the PHY_CLK_VALID bit unstable. Reported-by: Michael Braun <michael-dev@fami-braun.de> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Cc: stable <stable@vger.kernel.org> # 3.6+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-11usb: exynos: do not include plat/usb-phy.hArnd Bergmann
The definitions have moved to include/linux/usb/samsung-usb-phy.h, and plat/usb-phy.h is unavailable from drivers in a multiplatform configuration. Also fix up the plat/usb-phy.h header file to use the definitions from the new header instead of providing a separate copy. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-11usb: ohci-exynos: skip phy setup for Exynos5440 based platformsThomas Abraham
Exynos5440 does not require any explict USB phy configuration. So skip the USB phy configuration for Exynos5440 based platforms. Signed-off-by: Thomas Abraham <thomas.ab@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-09USB: enclose USB_XHCI_HCD related symbols within a if USB_XHCI_HCD blockFlorian Fainelli
This patch encloses all symbols depending on USB_XHCI_HCD within an if USB_XHCI_HCD / endif block. Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-09USB: enclose all depends on USB_OHCI_HCD within an if USB_OHCI_HCD blockFlorian Fainelli
This patch removes the various depends on USB_OHCI_HCD from the OHCI HCD drivers and enclose them within an if USB_OHCI_HCD / endif block. The Octeon OHCI HCD driver has been moved around to remain in this block. Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-09USB: enclose EHCI HCD drivers within an if USB_EHCI_HCD blockFlorian Fainelli
Thist patch removes the depends on USB_EHCI_HCD that the various USB EHCI HCD drivers use and encloses every driver within an if USB_EHCI_HCD / endif block. The EHCI HCD platform and Octeon drivers have been moved around to remain enclosed within this block. Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-09USB: remove USB_EHCI_BIG_ENDIAN_{DESC,MMIO} depends on architecture symbolFlorian Fainelli
Just like the OHCI counter part we just can remove the architecture specific symbols which prevent these configuration symbols from being selected by platforms/architectures requiring it. The original implementation did not scale at all since it required each and every single architecture to be added for these configuration symbols to be selected. Now it is up to the EHCI driver and/or platform to select these configuration symbols accordingly. Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-09USB: regroup all depends on USB within an if USB blockFlorian Fainelli
This patch removes the depends on USB from all config symbols in drivers/usb/host/Kconfig and replace that with an if USB / endif block as suggested by Alan Stern. Some source ... Kconfig lines have been shuffled around to permit a better regroupment of the Kconfig files depending on "config USB" item. No functionnal change is introduced. Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-09usb: ehci-s5p: fix: Fix null pointer dereferencingVivek Gautam
7edb3da: (USB: EHCI: make ehci-s5p a separate driver) raised an issue with ehci-s5p's driver data. Now that 's5p_ehci_hcd' doesn't maintain pointer to 'usb_hcd' and s5p_ehci is nothing but a pointer to hcd->priv; add hcd to the driver data rather than s5p_ehci. This fixes issues with null pointer dereferencing in s5p_ehci_shutdown(), s5p_ehci_suspend(), s5p_ehci_resume(). Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> CC: Manjunath Goudar <manjunath.goudar@linaro.org> CC: Arnd Bergmann <arnd@arndb.de> CC: Jingoo Han <jg1.han@samsung.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08Merge tag 'for-usb-next-2012-04-08' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci into usb-next Sarah writes: xHCI misc cleanup patches for 3.10 Hi Greg, Here's three cleanup patches for 3.10. Nothing big here, just some debugging output changes, a macro rename, and a math macro change that should have no behavioral effects. Tested on the Intel Panther Point xHCI host, with USB storage and mouse, with xHCI debugging turned on. I don't have the TI host that causes the debugging output changes to trigger. Sarah Sharp
2013-04-08USB: EHCI: make ehci-msm a separate driverManjunath Goudar
Separate the Qualcomm QSD/MSM on-chip host controller driver from ehci-hcd host code so that it can be built as a separate driver module. This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before Qualcomm QSD/MSM can be booted with a multi-platform kernel, which is not expected before 3.11. With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the msm bus glue. In V5 (arnd): - add FIXME about missing usb_add_hcd() or usb_remove_hcd() calls In V3: - Detailed commit message added here describing why this patch is required. - Arranged #include's in alphabetical order. - driver.name initialized hcd_name[] = "ehci-msm" in platform_driver structure initialization instead of "msm-ehci", which was the reason why it broke in EHCI USB testing In V2: Tegra patch related changes removed from this patch. Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: David Brown <davidb@codeaurora.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08USB: EHCI: make ehci-atmel a separate driverManjunath Goudar
Separate the Atmel host controller driver from ehci-hcd host code so that it can be built as a separate driver module. This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before Atmel can be booted with a multi-platform kernel. This is currently planned for Linux-3.11. With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the Atmel bus glue. In V4 (arnd): - reordered #include statements. - removed call to ehci_shutdown and the corresponding export In V3: - Detailed commit message added here about why this patch is required. - Replaced hcd_name string "ehci-atmel" to "atmel-ehci". - Inserted blank line in the Makefile to separate the EHCI drivers from the following non-EHCI drivers. - Exported ehci_shutdown symbol as it is needed by the Atmel driver. - Eliminated ehci_atmel_setup routine because hcd registers can be directly set in the ehci_atmel_drv_probe function. In V2: Resolved below compiler error. drivers/usb/host/ehci-atmel.c: In function 'ehci_atmel_drv_remove': drivers/usb/host/ehci-atmel.c:167: error: implicit declaration of function 'ehci_shutdown' Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Andrew Victor <linux@maxim.org.za> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08USB: EHCI: make ehci-s5p a separate driverManjunath Goudar
Separate the Samsung S5P/EXYNOS host controller driver from ehci-hcd host code so that it can be built as a separate driver module. This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before S5P/EXYNOS can be booted with a multi-platform kernel. We currently expect those to get merged for 3.10. With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the s5p bus glue. In V4 (arnd) - revert some of the pointless changes. - fix allocation of s5p specific data structure. In V3: - Detailed commit message added here, why this patch is required. - MODULE_LICENSE is GPL v2. - Added .extra_priv_size to eliminate the separate allocation of the s5p_ehci_hcd structure and removed .reset function pointer initialization. - Arranged #include's in alphabetical order. - After using extra_priv_size initialization, struct usb_hcd *hcd is redundant and can be removed from the probe function. - Eliminated s5p_ehci_phy_enable,contents of statements moved into the s5p_ehci_probe - Eliminated s5p_ehci_phy_disable, contents of statements moved into the s5p_ehci_remove. In V2: - Tegra patch related changes removed from this patch. Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org> Acked-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Cc: Kukjin Kim <kgene.kim@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08USB: EHCI: make ehci-spear a separate driverManjunath Goudar
Separate the SPEAr host controller driver from ehci-hcd host code so that it can be built as a separate driver module. This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before SPEAr can be booted with a multi-platform kernel, but they are queued in the arm-soc tree for 3.10. With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the SPEAr bus glue. In V4 (arnd): - renamed all 'struct spear_ehci' pointers from 'ehci' to the less ambiguous 'sehci'. - folded trivial spear_start_ehci/spear_stop_ehci functions into callers. - brought back initialization of ehci->caps. In V3: - Detailed commit message added here about why this patch is required. - Eliminated ehci_spear_setup routine because hcd registers can be directly set in the spear_ehci_hcd_drv_probe function. - spear_overrides struct initialized. - Converted to using .extra_priv_size for allocating spear_ehci, and updated all users of that structure. - to_spear_ehci() macro modified for spear_ehci. In V2: - Replaced spear as SPEAr everywhere, leaving functions/variables/config options. Signed-off-by: Deepak Saxena <dsaxena@linaro.org> Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Viresh Kumar <viresh.linux@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Cc: Shiraz Hashim <shiraz.hashim@st.com> Cc: spear-devel@list.st.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08USB: EHCI: make ehci-orion a separate driverManjunath Goudar
Separate the Orion host controller driver from ehci-hcd host code into its own driver module because of following reason. With the multiplatform changes in arm-soc tree, it becomes possible to enable the mvebu platform (which uses ehci-orion) at the same time as other platforms that require a conflicting EHCI bus glue. At the moment, this results in a warning like drivers/usb/host/ehci-hcd.c:1297:0: warning: "PLATFORM_DRIVER" redefined [enabled by default] drivers/usb/host/ehci-hcd.c:1277:0: note: this is the location of the previous definition drivers/usb/host/ehci-orion.c:334:31: warning: 'ehci_orion_driver' defined but not used [-Wunused-variable] and an ehci driver that only works on one of them. With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the orion bus glue. An earlier version of this patch was included in 3.9 but caused a regression there, which has subsequently been fixed. While we are here, use the opportunity to disabiguate the two Marvell EHCI controller implementations in Kconfig. In V4 (arnd): - Improve Kconfig text In V3: - More detail provided in commit message regarding this patch. - Replaced hcd_name string "ehci-orion" into "orion-ehci". - MODULE_LICENSE is GPL v2. - In ehci_init_driver calling second argument passed as NULL instead of ehci_orion_overrides because ehci_orion_overrides is removed. In V2: - Tegra patch related changes removed from this patch. Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Jason Cooper <jason@lakedaemon.net> Tested-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-08xhci - clarify compliance mode debug messagesTony Camuso
There are no functional changes in this patch. However, because the compliance mode timer can be deleted in more than one function, it seemed expedient to include the function name in the debug strings. Also limited the use of capitals to the first word in the compliance mode debug messages, except after a function name where all words start with lower case, in keeping with the style prevalent elsewhere in xhci.c. Signed-off-by: Tony Camuso <tcamuso@redhat.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-04-05Merge tag 'usb-for-v3.10' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v3.10 merge window Here is the big Gadget & PHY pull request. Many of us have been really busy lately getting multiple drivers to a better position. Since this pull request is so large, I will divide it in sections so it's easier to grasp what's included. - cleanups: . UDC drivers no longer touch gadget->dev, that's now udc-core responsibility . Many more UDC drivers converted to usb_gadget_map/unmap_request() . UDC drivers no longer initialize DMA-related fields from gadget's device structure . UDC drivers don't touch gadget.dev.driver directly . UDC drivers don't assign gadget.dev.release directly . Removal of some unused DMA_ADDR_INVALID . Introduction of CONFIG_USB_PHY . All phy drivers have been moved to drivers/usb/phy and renamed to a common naming scheme . Fix PHY layer so it never returns a NULL pointer, also fix all callers to avoid using IS_ERR_OR_NULL() . Sparse fixes all over the place . drivers/usb/otg/ has been deleted . Marvel drivers (mv_udc, ehci-mv, mv_otg and mv_u3d) improved clock usage - new features: . UDC core now provides a generic way for tracking and reporting UDC's state (not attached, resuming, suspended, addressed, default, etc) . twl4030-usb learned that it shouldn't be enabled during init . Full DT support for DWC3 has been implemented . ab8500-usb learned about pinctrl framework . nop PHY learned about DeviceTree and regulators . DWC3 learned about suspend/resume . DWC3 can now be compiled in host-only and gadget-only (as well as DRD) configurations . UVC now enables streaming endpoint based on negotiated speed . isp1301 now implements the PHY API properly . configfs-based interface for gadget drivers which will lead to the removal of all code which just combines functions together to build functional gadget drivers. . f_serial and f_obex were converted to new configfs interface while maintaining old interface around. - non-critical fixes: . UVC gadget driver got fixes for Endpoint usage and stream calculation . ab8500-usb fixed unbalanced clock and regulator API usage . twl4030-usb got a fix for when OMAP3 is booted with cable connected . fusb300_udc got a fix for DMA usage . UVC got fixes for two assertions of the USB Video Class Compliance specification revision 1.1 . build warning issues caused by recent addition of __must_check to regulator API These are all changes which deserve a mention, all other changes are related to these one or minor spelling fixes and other similar tasks. Signed-of-by: Felipe Balbi <balbi@ti.com>
2013-04-03usb: host: ehci-tegra: Fix oops in error cleanupThierry Reding
The cleanup path checks whether the transceiver was properly initialized using IS_ERR(). However it can also happen that the cleanup path is run before the transceiver was initialized (or the operating mode isn't set to TEGRA_USB_OTG) and is therefore NULL. Add a separate label for error unwinding and initialize the transceiver field to ERR_PTR(-ENODEV) when the operating mode isn't TEGRA_USB_OTG to allow for consistent checking. Signed-off-by: Thierry Reding <thierry@gilfi.de> Acked-by: Stephen Warren <swarren@nvidia.com> Acked-by: Venu Byravarasu <vbyravarasu@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-03usb: host: tegra: Reset Tegra USB controller before initVenu Byravarasu
To clear any configurations made by U-Boot on Tegra USB controller, reset it before init in probe. Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-03EHCI: Quirk flag for port power handling on overcurrent.Christian Engelmayer
Commit 756aa6b3d536afe85e151138cb03a293998887b3 (ehci-hub: improved over-current recovery) added port power cycling on overcurrent indications as needed by the MPC8349 USB controller after resolving of the overcurrent situation in order to have the host state machine assert the correct port status again. Commit 81463c1d707186adbbe534016cd1249edeab0dac (EHCI: only power off port if over-current is active) solved a thus resulting issue of endless overcurrent changes in combination with the MAX4967 USB power supply chip that signals overcurrent when power is not enabled by only powering off a port if the overcurrent is currently active. Added quirks flag need_oc_pp_cycle in order to specify the needed behaviour as there is no common behaviour that can comply with both requirements. Activated the quirks handling for Freescale 83xx based boards. Signed-off-by: Christian Engelmayer <christian.engelmayer@frequentis.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-03xhci: Rename SEGMENT_SIZE and SEGMENT_SHIFT as the former is used in a.out.hDavid Howells
Rename SEGMENT_SIZE and SEGMENT_SHIFT as the former is used in a.out.h. Signed-off-by: David Howells <dhowells@redhat.com> cc: Sarah Sharp <sarah.a.sharp@linux.intel.com> cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> cc: linux-usb@vger.kernel.org Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-04-03xhci: Use ilog2() rather than __ffs() for calculating SEGMENT_SHIFTDavid Howells
Use ilog2() rather than __ffs() for calculating SEGMENT_SHIFT as ilog2() can be worked out at compile time, whereas __ffs() must be calculated at runtime. Signed-off-by: David Howells <dhowells@redhat.com> cc: Sarah Sharp <sarah.a.sharp@linux.intel.com> cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> cc: linux-usb@vger.kernel.org Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-04-02usb: ehci: mv_ehci: remove unused clockChao Xie
The origianl understanding of clock is wrong. The EHCI controller only have one clock input. Passing clock name by pdata is wrong. The clock is defined by device iteself. Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Chao Xie <chao.xie@marvell.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-01usb: PS3 EHCI remove unneeded ehci_shutdownGeoff Levand
Remove an unneeded call to ehci_shutdown() in ps3_ehci_remove(). This removal will allow for a loadable ehci driver. Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Geoff Levand <geoff@infradead.org> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28usb: ehci: mark unlink_empty_async_suspended() as __maybe_unusedArnd Bergmann
Patch 4d053fdac3 "usb: ehci: unlink_empty_async_suspended() only used with CONFIG_PM" tried to hide the unlink_empty_async_suspended function inside of an #ifdef to work around an unused function warning. Unfortunately that had the effect of introducing a new warning: drivers/usb/host/ehci-q.c:1297:13: warning: 'unlink_empty_async_suspended' declared 'static' but never defined [-Wunused-function] While we could add another #ifdef around the function declaration to avoid this, a nicer solution is to mark it as __maybe_unused, which will let gcc silently drop the function definition when it is not needed. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28USB: EHCI: DT support for generic bus glueArnd Bergmann
This lets us use the ehci-platform driver on platforms without special requirements for their ehci controllers. In particular, this is true for the vt8500/wm8x50 platforms, which currently have a separate driver that causes problems with multiplatform configurations. Tested-by: Tony Prisk <linux@prisktech.co.nz> Tested-by: Peter Vasil <petervasil@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28usb: ehci: unlink_empty_async_suspended() only used with CONFIG_PMTony Prisk
Compiling with !CONFIG_PM generates an unused function warning on unlink_empty_async_suspended(). Enclose the function in a #ifdef CONFIG_PM Signed-off-by: Tony Prisk <linux@prisktech.co.nz> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28USB: ehci-spear: add CONFIG_PM_SLEEP to suspend/resume functionsJingoo Han
Add CONFIG_PM_SLEEP to suspend/resume functions to fix the following build warning when CONFIG_PM_SLEEP is not selected. This is because sleep PM callbacks defined by SIMPLE_DEV_PM_OPS are only used when the CONFIG_PM_SLEEP is enabled. drivers/usb/host/ehci-spear.c:82:12: warning: 'ehci_spear_drv_suspend' defined but not used [-Wunused-function] drivers/usb/host/ehci-spear.c:90:12: warning: 'ehci_spear_drv_resume' defined but not used [-Wunused-function] Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28usb: echi-sh: Remove driver variable which is not usedNobuhiro Iwamatsu
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28usb: ehci-sh: Fix build error due to comma has been deletedNobuhiro Iwamatsu
By commit 39d3568 (USB: remove incorrect __exit markups), comma following ehci_hcd_sh_remove has been deleted. This fixes the error by the correction. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> CC: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28USB: remove CONFIG_USB_SUSPEND optionAlan Stern
This patch (as1675) removes the CONFIG_USB_SUSPEND option, essentially replacing it everywhere with CONFIG_PM_RUNTIME (except for one place in hub.c, where it is replaced with CONFIG_PM because the code needs to be used in both runtime and system PM). The net result is code shrinkage and simplification. There's very little point in keeping CONFIG_USB_SUSPEND because almost everybody enables it. The few that don't will find that the usbcore module has gotten somewhat bigger and they will have to take active measures if they want to prevent hubs from being runtime suspended. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28Merge branch 'usb-linus' into usb-nextGreg Kroah-Hartman
This lets us fix the build error that happens when these two trees are merged together. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-26Merge tag 'for-usb-linus-2013-03-26' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci into usb-linus Misc xHCI fixes for 3.9 Hi Greg, Here's a couple of fixes for the xHCI driver. Three patches are nothing major: build warning fix, macro field width fix, and removing some unnecessary log spam. The only interesting thing here is Tianyu's two patches to fix the USB port connection type discovery, for the USB port power off mechanism. This adds new USB host API, but as discussed, it's necessary to avoid powering off the wrong USB port. It's not marked for backport to stable kernels, since the sysfs mechanism to manually power off a port didn't go in until 3.9. I've smoke tested these, including system suspend, USB device suspend, and rocking out in my cube with a pair of USB headphones. They look fine to me. Hibernate is currently broken on my system, due to some nouveau MMIO read faults. I'll report that separately. Sarah Sharp
2013-03-25USB: EHCI: fix bug in iTD/siTD DMA pool allocationSoeren Moch
[Description written by Alan Stern] Soeren tracked down a very difficult bug in ehci-hcd's DMA pool management of iTD and siTD structures. Some background: ehci-hcd gives each isochronous endpoint its own set of active and free itd's (or sitd's for full-speed devices). When a new itd is needed, it is taken from the head of the free list, if possible. However, itd's must not be used twice in a single frame because the hardware continues to access the data structure for the entire duration of a frame. Therefore if the itd at the head of the free list has its "frame" member equal to the current value of ehci->now_frame, it cannot be reused and instead a new itd is allocated from the DMA pool. The entries on the free list are not released back to the pool until the endpoint is no longer in use. The bug arises from the fact that sometimes an itd can be moved back onto the free list before itd->frame has been set properly. In Soeren's case, this happened because ehci-hcd can allocate one more itd than it actually needs for an URB; the extra itd may or may not be required depending on how the transfer aligns with a frame boundary. For example, an URB with 8 isochronous packets will cause two itd's to be allocated. If the URB is scheduled to start in microframe 3 of frame N then it will require both itds: one for microframes 3 - 7 of frame N and one for microframes 0 - 2 of frame N+1. But if the URB had been scheduled to start in microframe 0 then it would require only the first itd, which could cover microframes 0 - 7 of frame N. The second itd would be returned to the end of the free list. The itd allocation routine initializes the entire structure to 0, so the extra itd ends up on the free list with itd->frame set to 0 instead of a meaningful value. After a while the itd reaches the head of the list, and occasionally this happens when ehci->now_frame is equal to 0. Then, even though it would be okay to reuse this itd, the driver thinks it must get another itd from the DMA pool. For as long as the isochronous endpoint remains in use, this flaw in the mechanism causes more and more itd's to be taken slowly from the DMA pool. Since none are released back, the pool eventually becomes exhausted. This reuslts in memory allocation failures, which typically show up during a long-running audio stream. Video might suffer the same effect. The fix is very simple. To prevent allocations from the pool when they aren't needed, make sure that itd's sent back to the free list prematurely have itd->frame set to an invalid value which can never be equal to ehci->now_frame. This should be applied to -stable kernels going back to 3.6. Signed-off-by: Soeren Moch <smoch@web.de> Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25USB: EHCI: remove unused variable in unlink_empty_async()Alan Stern
This patch (as1669) removes the check_unlinks_later flag in ehci-hcd's unlink_empty_async(). It wasn't being used for anything and should have been removed in an earlier patch, but I forgot about it. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25USB: EHCI: improve end_unlink_async()Alan Stern
This patch (as1665) changes the way ehci-hcd's end_unlink_async() routine works in order to avoid recursive execution and to be more efficient: Now when an IAA cycle ends, a new one gets started up right away (if it is needed) instead of waiting until the just-unlinked QH has been processed. The async_iaa list is renamed to async_idle, which better expresses its new purpose: It is now the list of QHs which are now completely idle and are waiting to be processed by end_unlink_async(). A new flag is added to track whether an IAA cycle is in progress, because the list formerly known as async_iaa no longer stores the QHs waiting for the IAA to finish. The decision about how many QHs to process when an IAA cycle ends is now made at the end of the cycle, when we know the current state of the hardware, rather than at the beginning. This means a bunch of logic got moved from start_iaa_cycle() to end_unlink_async(). Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25USB: EHCI: convert singly-linked lists to list_headsAlan Stern
This patch (as1664) converts ehci-hcd's async_unlink, async_iaa, and intr_unlink from singly-linked lists to standard doubly-linked list_heads. Originally it didn't seem necessary to use list_heads, because items are always added to and removed from these lists in FIFO order. But now with more list processing going on, it's easier to use the standard routines than continue with a roll-your-own approach. I don't know if the code ends up being notably shorter, but the patterns will be more familiar to any kernel hacker. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25USB: EHCI: consolidate code in ehci_urb_dequeue()Alan Stern
This patch (as1668) consolidates two nearly identical code paths in ehci_urb_dequeue(). The test for !qh can be removed because it will never succeed; the fact that usb_hcd_check_unlink_urb() returned 0 means that urb must be queued and therefore urb->hcpriv must point to a QH. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25USB: EHCI: split needs_rescan into two flagsAlan Stern
This patch (as1662) does some more QH-related cleanup in ehci-hcd. The qh->needs_rescan flag is currently used for two different purposes; the patch replaces it with two separate flags for greater clarity: qh->dequeue_during_giveback indicates that a completion handler dequeued an URB (implying that a rescan is needed), and qh->exception indicates that the QH is in an exceptional state requiring an unlink (either it encountered an I/O error or an unlink was requested). The new flags get set where the dequeue, exception, or unlink request occurred, rather than where the unlink is started. This is so that in the future, if we need to, we will be able to tell apart unlinks that truly were required from those that were carried out merely because the QH wasn't being used. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25USB: EHCI: change return value of qh_completions()Alan Stern
This patch (as1658) cleans up the usage of qh_completions() in ehci-hcd. Currently the function's return value indicates whether any URBs were given back; the idea was that the caller can scan the QH over again to handle any URBs that were dequeued by a completion handler. This is not necessary; when qh_completions() is ready to give back dequeued URBs, it does its own rescanning. Therefore the new return value will be a flag indicating whether the caller needs to unlink the QH. This is more convenient than forcing the caller to check qh->needs_rescan, and it makes a lot more sense -- why should "needs_rescan" imply that an unlink is needed? The callers are also changed to remove the unneeded rescans. Lastly, the check for whether qh->qtd_list is non-empty is removed from the start of qh_completions(). Two of the callers have to make this test anyway, so the same test can simply be added to the other two callers. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25USB: EHCI: changes related to qh_refresh()Alan Stern
This patch (as1638) makes several changes to the ehci-hcd driver, all related to the qh_refresh() function. This function must be called whenever an idle QH gets linked back into either the async or the periodic schedule. Change a BUG_ON() in the qh_update routine to a WARN_ON(). Since this code runs in atomic context, a BUG_ON() would immediately freeze the whole system. Remove two unneeded calls to qh_refresh(), one when a QH is initialized and one when a QH becomes idle. Adjust the adjacent comments accordingly. Move the qh_refresh() and qh_link_periodic() calls for new interrupt URBs to after the new TDs have been added. As a result of the previous two changes, qh_refresh() is never called when the qtd_list is empty. The corresponding check in qh_refresh() can be removed, along with an indentation level. These changes should not cause any alteration of behavior. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25xhci: Don't warn on empty ring for suspended devices.Sarah Sharp
When a device attached to the roothub is suspended, the endpoint rings are stopped. The host may generate a completion event with the completion code set to 'Stopped' or 'Stopped Invalid' when the ring is halted. The current xHCI code prints a warning in that case, which can be really annoying if the USB device is coming into and out of suspend. Remove the unnecessary warning. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Tested-by: Stephen Hemminger <stephen@networkplumber.org>
2013-03-25usb: xhci: Fix TRB transfer length macro used for Event TRB.Vivek Gautam
Use proper macro while extracting TRB transfer length from Transfer event TRBs. Adding a macro EVENT_TRB_LEN (bits 0:23) for the same, and use it instead of TRB_LEN (bits 0:16) in case of event TRBs. This patch should be backported to kernels as old as 2.6.31, that contain the commit b10de142119a676552df3f0d2e3a9d647036c26a "USB: xhci: Bulk transfer support". This patch will have issues applying to older kernels. Signed-off-by: Vivek gautam <gautam.vivek@samsung.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: stable@vger.kernel.org
2013-03-25usb: add find_raw_port_number callback to struct hc_driver()Lan Tianyu
xhci driver divides the root hub into two logical hubs which work respectively for usb 2.0 and usb 3.0 devices. They are independent devices in the usb core. But in the ACPI table, it's one device node and all usb2.0 and usb3.0 ports are under it. Binding usb port with its acpi node needs the raw port number which is reflected in the xhci extended capabilities table. This patch is to add find_raw_port_number callback to struct hc_driver(), fill it with xhci_find_raw_port_number() which will return raw port number and add a wrap usb_hcd_find_raw_port_number(). Otherwise, refactor xhci_find_real_port_number(). Using xhci_find_raw_port_number() to get real index in the HW port status registers instead of scanning through the xHCI roothub port array. This can help to speed up. All addresses in xhci->usb2_ports and xhci->usb3_ports array are kown good ports and don't include following bad ports in the extended capabilities talbe. (1) root port that doesn't have an entry (2) root port with unknown speed (3) root port that is listed twice and with different speeds. So xhci_find_raw_port_number() will only return port num of good ones and never touch bad ports above. Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-03-25usb: xhci: fix build warningPeter Chen
/home/b29397/work/code/git/linus/linux-2.6/drivers/usb/host/xhci-ring.c: In function ‘handle_port_status’: /home/b29397/work/code/git/linus/linux-2.6/drivers/usb/host/xhci-ring.c:1580: warning: ‘hcd’ may be used uninitialized in this function Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-03-21USB: EHCI: fix up incorrect merge resolutionAlan Stern
This patch (as1671) fixes up an incorrect resolution of a merge conflict between Greg KH's usb-linus branch and his usb-next branch. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-21usb: host: ehci-tegra: fix PHY error handlingFelipe Balbi
PHY layer no longer returns NULL, we must switch from IS_ERR_OR_NULL() to IS_ERR(). Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-20Merge branch 'usb-linus' into usb-nextGreg Kroah-Hartman
This is to pick up the fixes in that branch, and let Alan fix the merge error in drivers/usb/host/ehci-timer.c better than I just did (as I know I messed it up...) Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>