aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/musb/musb_dsps.c
AgeCommit message (Collapse)Author
2015-10-22usb: musb: dsps: fix polling in device-only modeBin Liu
commit b8239dcc03afbd0886c1d9b91ba8fee7c6c9a6cb upstream. Fix the regression caused by commit ad78c918602 ("usb: musb: dsps: just start polling already") which causes polling the ID pin status even in device-only mode. Fixes: ad78c918602c ("usb: musb: dsps: just start polling already") Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03usb: musb: dsps: fix build on i386 when COMPILE_TEST is setTony Lindgren
Commit 3e457371f436 ("usb: musb: Fix fifo reads for dm816x with musb_dsps") fixed a USB error on dm816x, but introduced a new build error on i386 when COMPILE_TEST is set: drivers/usb/musb/musb_dsps.c: In function ‘dsps_read_fifo32’: drivers/usb/musb/musb_dsps.c:624:3: error: implicit declaration of function ‘readsl’ [-Werror=implicit-function-declaration] readsl(fifo, dst, len >> 2); Let's fix this by using ioread32_rep() instead of readsl() as that's more portable. Fixes: 3e457371f436 ("usb: musb: Fix fifo reads for dm816x with musb_dsps") Reported-by: Fengguang Wu <fengguang.wu@intel.com> Cc: Bin Liu <binmlist@gmail.com> Cc: Brian Hutchinson <b.hutchman@gmail.com> Cc: George Cherian <george.cherian@ti.com> Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24usb: musb: Fix fifo reads for dm816x with musb_dspsTony Lindgren
Looks like dm81xx can only do 32-bit fifo reads like am35x. Let's set up musb-dsps with a custom read_fifo function based on the compatible flag. Otherwise we can get the following errors when starting dhclient on a asix USB Ethernet adapter: asix 2-1:1.0 eth2: asix_rx_fixup() Bad Header Length 0xffff003c, offset 4 While at it, let's also remove pointless cast of the driver data. Cc: Bin Liu <binmlist@gmail.com> Cc: Brian Hutchinson <b.hutchman@gmail.com> Cc: George Cherian <george.cherian@ti.com> Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-11usb: musb: dsps: don't fake of_node to musb coreFelipe Balbi
If we pass our own of_node to musb_core, at least pinctrl settings will be duplicated, meaning that pinctrl framework will try to select default pin state for musb_core when they were already requested by musb-dsps. A Warning will be printed however things will still work. Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-11usb: musb: dsps: request phy using our device pointerFelipe Balbi
musb shouldn't have of_node and phy phandle is passed to dsps device, not musb's. Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10usb: musb: dsps: just start polling alreadyFelipe Balbi
there's no need to fake an IRQ, just check if VBUS is valid already. Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10usb: musb: dsps: use msecs_to_jiffies insteadFelipe Balbi
when polling, we were using n * HZ (where n is an integer in seconds), however HZ isn't always correct if we're using cpufreq. A better way is to use msecs_to_jiffies(n) (where n is now an integer in miliseconds). while at that, also rename poll_seconds to poll_timeout and change its type to unsigned int. Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10usb: musb: rename ->reset() to ->recover()Felipe Balbi
recover is a much better name than reset, considering we don't really reset the IP, just run platform-specific babble recovery algorithm. while at that, also fix a typo in comment and add kdoc for recover memeber of platform_ops. Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10usb: musb: dsps: do not reset musb on babbleFelipe Balbi
All we have to do is, really, drop session bit and let the session restart. Big thanks goes to Bin Liu <b-liu@ti.com> for inspiring this work. Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10usb: musb: dsps: add dsps_ prefix to sw_babble_controlFelipe Balbi
this makes it easier to filter function traces. No functional changes. Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10usb: musb: dsps: check for the single bitFelipe Balbi
We want to check if that particular bit is set. It could very well be that bootloader (or romcode) has fiddled with MUSB before us which could leave other bits set in this register. Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10usb: musb: dsps: remove babble check from dsps irq handlerFelipe Balbi
musb->int_usb already contains the correct information for musb-core to handle babble. In fact, this very check was just causing a nonsensical babble interrupt storm. With this I can get test.sh to run and, even though all tests fail with timeout, that's still better than locking up the system due to IRQ storm. Also, if I remove g_zero and load g_mass_storage, then everything works fine again. Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-10usb: musb: dsps: return error code if reset failsFelipe Balbi
if reset fails, we should return a *negative* error code, not a positive value. Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-02-23usb: musb: Fix getting a generic phy for musb_dspsTony Lindgren
We still have a combination of legacy phys and generic phys in use so we need to support both types of phy for musb_dsps.c. Cc: Brian Hutchinson <b.hutchman@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-02-23usb: musb: Fix use for of_property_read_bool for disabled multipointTony Lindgren
The value for the multipoint dts property is ignored when parsing with of_property_read_bool, so we currently have multipoint always set as 1 even if value 0 is specified in the dts file. Let's fix this to read the value too instead of just the property like the binding documentation says as otherwise MUSB will fail to work on devices with Mentor configuration that does not support multipoint. Cc: Brian Hutchinson <b.hutchman@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-25usb: musb: Change end point selection to use new IO accessTony Lindgren
This allows the endpoints to work when multiple MUSB glue layers are built in. Cc: Fabio Baltieri <fabio.baltieri@linaro.org> Cc: Lee Jones <lee.jones@linaro.org> Cc: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Apelete Seketeli <apelete@seketeli.net> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: move the OTG state from the USB PHY to the OTG structureAntoine Tenart
Before using the PHY framework instead of the USB PHY one, we need to move the OTG state into another place, since it won't be available when USB PHY isn't used. This patch moves the OTG state into the OTG structure, and makes all the needed modifications in the drivers using the OTG state. [ balbi@ti.com : fix build regressions with phy-tahvo.c, musb_dsps.c, phy-isp1301-omap, and chipidea's debug.c ] Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Acked-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: musb: dsps: remove duplicate check on resourceVarka Bhadram
Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram <varkab@cdac.in> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: musb: musb_dsps: delete unnecessary 'out of memory' messagesPeter Chen
The memory subsystem has already had similar message for it. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23usb: musb: musb_dsps: fix NULL pointer in suspendSebastian Andrzej Siewior
So testing managed to configure musb in DMA mode but not load the matching cppi41 driver for DMA. This results in |musb-hdrc musb-hdrc.0.auto: Failed to request rx1. |musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517 |platform musb-hdrc.0.auto: Driver musb-hdrc requests probe deferral which is "okay". Once the driver is loaded we re-try probing and everyone is happy. Until then if you try suspend say echo mem > /sys/power/state then you go boom |Unable to handle kernel NULL pointer dereference at virtual address 000003a4 |pgd = cf50c000 |[000003a4] *pgd=8f6a3831, *pte=00000000, *ppte=00000000 |Internal error: Oops: 17 [#1] ARM |PC is at dsps_suspend+0x18/0x9c [musb_dsps] |LR is at dsps_suspend+0x18/0x9c [musb_dsps] |pc : [<bf08e268>] lr : [<bf08e268>] psr: a0000013 |sp : cbd97e00 ip : c0af4394 fp : 00000000 |r10: c0831d90 r9 : 00000002 r8 : cf6da410 |r7 : c03ba4dc r6 : bf08f224 r5 : 00000000 r4 : cbc5fcd0 |r3 : bf08e250 r2 : bf08f264 r1 : cf6da410 r0 : 00000000 |[<bf08e268>] (dsps_suspend [musb_dsps]) from [<c03ba508>] (platform_pm_suspend+0x2c/0x54) |Code: e1a04000 e9900041 e2800010 eb4caa8e (e59053a4) because platform_get_drvdata(glue->musb) returns a NULL pointer as long as the device is not fully probed. Tested-by: George Cherian <george.cherian@ti.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23usb: musb: dsps: start OTG timer on resume againSebastian Andrzej Siewior
Commit 468bcc2a2ca ("usb: musb: dsps: kill OTG timer on suspend") stopped the timer in suspend path but forgot the re-enable it in the resume path. This patch fixes the behaviour. Cc: <stable@vger.kernel.org> # v3.14+ Fixes 468bcc2a2ca "usb: musb: dsps: kill OTG timer on suspend" Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-16usb: musb: dsps: kill OTG timer on suspendFelipe Balbi
if we don't make sure to kill the timer, it could expire after we have already gated our clocks. That will trigger a Data Abort exception because we would try to access register while clock is gated. Fix that bug. Cc: <stable@vger.kernel.org> # v3.14+ Fixes 869c597 (usb: musb: dsps: add support for suspend and resume) Tested-by: Dave Gerlach <d-gerlach@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-21Merge tag 'usb-for-v3.17' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v3.17 merge window Surprisingly enough, while a big set of patches, the majority is composed of cleanups (using devm_*, fixing sparse errors, moving code around, adding const, etc). The highlights are addition of new support for PLX USB338x devices, and support for USB 2.0-only configurations of the DWC3 IP core. Signed-of-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: musb: dsps: Add the sw_babble_control() and Enable for newer siliconGeorge Cherian
Add sw_babble_control() logic to differentiate between transient babble and real babble condition. Also add the SW babble control register definitions. Babble control register logic is implemented in the latest revision of AM335x. Find whether we are running on newer silicon. The babble control register reads 0x4 by default in newer silicon as opposed to 0 in old versions of AM335x. Based on this enable the sw babble control logic. Signed-off-by: George Cherian <george.cherian@ti.com> Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: musb: core: Convert the musb_platform_reset to have a return value.George Cherian
Currently musb_platform_reset() is only used by dsps. In case of BABBLE interrupt for other platforms the musb_platform_reset() is a NOP. In such situations no need to re-initialize the endpoints. Also in the latest silicon revision of AM335x, we do have a babble recovery mechanism without resetting the IP block. In preperation to add that support its better to have a rest_done return for musb_platform_reset(). Signed-off-by: George Cherian <george.cherian@ti.com> Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: musb: dsps: fix the base address for accessing the mode registerLothar Waßmann
commit 943c13971c08 "usb: musb: dsps: implement ->set_mode()" should have made it possible to use the driver with boards that have the USBID pin unconnected. This doesn't actually work, since the driver uses the wrong base address to access the mode register. Furthermore it uses different base addresses in different places to access the same register (phy_utmi). Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: musb: dsps: Call usb_phy(_shutdown/_init) during musb_platform_reset()George Cherian
For DSPS platform usb_phy_vbus(_off/_on) are NOPs. So during musb_platform_reset() call usb_phy(_shutdown/_init) Signed-off-by: George Cherian <george.cherian@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: musb: dsps: coding style cleanupLothar Waßmann
There is no reason for the register accessor functions not to adhere to the CodingStyle rules. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-05-23Merge tag 'usb-for-v3.16' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v3.16 merge window Not a lot here during this merge window. Mostly we just have the usual miscellaneous patches (removal of unnecessary prints, proper dependencies being added to Kconfig, build warning fixes, new device ID, etc. Other than those, the only important new features are the new support for OS Strings which should help Linux Gadget Drivers behave better under MS Windows. Also Babble Recovery implementation for MUSB on AM335x. Lastly, we also have ARCH_QCOM PHY support though phy-msm. Signed-of-by: Felipe Balbi <balbi@ti.com> Conflicts: drivers/usb/phy/phy-mv-u3d-usb.c
2014-04-21usb: musb: dsps: compile suspend/resume only with PM_SLEEPWolfram Sang
Depending on PM is not enough, because only PM_RUNTIME could be selected. Fixes: drivers/usb/musb/musb_dsps.c:703:12: warning: 'dsps_suspend' defined but not used [-Wunused-function] drivers/usb/musb/musb_dsps.c:721:12: warning: 'dsps_resume' defined but not used [-Wunused-function] Signed-off-by: Wolfram Sang <wsa@sang-engineering.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-04-21usb: musb: dsps: handle babble interruptsDaniel Mack
When the dsps isr sees a babble error, pass it down to the core for fixup. Also, provide a .reset hook so the core can call us back. A babble interrupt error occured when a USB mass storage device ("CHIPSBNK v3.3.9.1", 1e3d:2093) was disconnected from a AM33xx host. Signed-off-by: Daniel Mack <zonque@gmail.com> Reported-by: Thomas Mellenthin <mellenthin@teufel.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-04-21usb: phy: rename <linux/usb/usb_phy_gen_xceiv.h> to ↵Felipe Balbi
<linux/usb/usb_phy_generic.h> now that all functions match the driver name, the only missing piece is to rename the header file itself. Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-04-16usb: musb: dsps: move debugfs_remove_recursive()Daniel Mack
When the platform initialization fails due to missing resources, it will return -EPROBE_DEFER after dsps_musb_init() has been called. dsps_musb_init() calls dsps_musb_dbg_init() to allocate the debugfs nodes. At a later point in time, the probe will be retried, and dsps_musb_dbg_init() will be called again. debugfs_create_dir() will fail this time, as the node already exists, and so the entire device probe will fail with -ENOMEM. Fix this by moving debugfs_remove_recursive() from dsps_remove() to the plaform's exit function, so it will be cleanly torn down when the probe fails. It also feels more natural this way, as .exit is the counterpart to .init. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-02-20usb: musb: dsps, debugfs filesMarkus Pargmann
debugfs files to show the contents of important dsps registers. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-02-18usb: musb: dsps, use devm_kzallocMarkus Pargmann
Replace kzalloc by devm_kzalloc and remove the kfree() calls. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-01-08usb: delete non-required instances of include <linux/init.h>Paul Gortmaker
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-26usb: musb: dsps: polling ID pin status only in otg modeBin Liu
Only start the otg_timer in dual role mode; otherwise in peripheral mode when musb is disconnected from the host port, otg_timer starts and continuously toggles the session, which causes VBUS pulse. Signed-off-by: Bin Liu <b-liu@ti.com> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26usb: musb: dsps: add support for suspend and resumeDaniel Mack
The dsps platform needs to save save some registers at suspend time and restore them after resume. This patch adds a struct for these registers, and also lets the musb core know that the core registers need to be saved as well. We also have to explicitly de-assert the port reset upon resume on this platform, but musb_port_reset() should not be called from glue layers. Hence, introduce a flag in struct musb_hdrc_config for this. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26usb: musb: dsps: add {tx,rx}_mode to wrapperDaniel Mack
rx_mode and tx_mode need to be read at suspend time and restored on resume for dsps platforms. So add it to the wrapper struct first, and initialize the values. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-11-26usb: musb: dsps: implement ->set_mode()Felipe Balbi
this will let us support broken designs such as AM335x EVM SK where ID pin isn't routed anywhere on a host port. With this we can toggle internal IDDIG signal and make sure MUSB goes into host mode as necessary. Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-24Merge tag 'usb-for-v3.13' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v3.13 Final conversions to configfs for mass storage, acm_ms, and multi gadgets. MUSB should now work out of the box on AM335x-based boards (beagle bone white and black) with DMA thanks to Sebastian's work. We can now enable VERBOSE_DEBUG on builds of drivers/usb/gadget/ by selecting CONFIG_USB_GADGET_VERBOSE. s3c-hsotg got quite a few non-critical fixes but also learned a few new tricks (isochronous transfers, multi count support). The Marvel USB3 Controller driver got a memory leak fix. devm_usb_get_phy() learned not to return NULL, ever. Other than these patches, we have the usual set of cleanups ranging from removal of unnecessary *_set_drvdata() to using SIMPLE_DEV_PM_OPS. Signed-of-by: Felipe Balbi <balbi@ti.com>
2013-10-17usb: musb: dsps: run the timer only on OTG systemsSebastian Andrzej Siewior
I introduced this check here because it looked wrong in HOST only configurions. The timer would remove that session bit and will never come back and so there would not be another session. Now that I played with OTG for a while I belive this workaround is only required for the OTG mode because we have to end the session and then we have to try to start manually. Therefore, this patch limits this timer to the OTG only port mode so we don't need to poll around in device only mode. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-17usb: musb: dsps: redo the otg timerSebastian Andrzej Siewior
According to the comments, we rely on the OTG timer because the core does not expose some important OTG details. So far this is all I know. After playing with OTG I stumbled over a problem: musb is recognized as a B-device without a problem. Whenever a cable is plugged, the VBUS rises, musb recognizes this as a starting session, sets the MUSB_DEVCTL_SESSION bit by itself and a RESET interrupt occurs, the session starts. Good. After a disconnect, the timer is started and re-starts itself because it remains in B_IDLE with the BDEVICE set. I didn't figure the the reason or the need for it. Nothing changes here except for OTG state from B to A device if the BDEVICE bit disappears. This doesn't make much sense to me because nothing happens after this. _IF_ we receive an interrupt before the state change then we may act on wrong condition. Plugging a B-device (and letting MUSB act as host) doesn't work here. The reason seems to be that the MUSB tries to start a session, it fails and then it removes the bit. So we never start as a host. This patch sets the MUSB_DEVCTL_SESSION bit in the IDLE state so musb can try to establish a session as host. After the bit is set, musb tries to start a session and if it fails it clears the bit. Therefore it will try over and over again until a session either as host or as device is established. The readout of the MUSB_DEVCTL register after the removal the MUSB_DEVCTL_SESSION (in A_WAIT_BCON) has been removed because it did not contain the BDEVICE bit set (in the second read) leading to A_IDLE. After plugging a host musb assumed that it is also a host and complained about a missing reset. However a third read of the register has has the BDEVICE bit set so it seems that it is not stable. This mostly what da8xx.c is doing except that we set the timer also after A_WAIT_BCON so the session bit can be triggered. Whit this change I was able to keep am335x-evm in OTG mode and plug in either a HOST or a DEVICE and in a random order and the device was recognized. Cc: stable@vger.kernel.org # v3.11 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-17usb: musb: dsps: remove declartion for dsps_musb_try_idle()Sebastian Andrzej Siewior
This patch moves dsps_musb_try_idle() before dsps_musb_enable() so the declaration (of dsps_musb_try_idle() can be removed. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-17usb: musb: dsps: move try_idle to start hookSebastian Andrzej Siewior
The timer is initialized right after musb is probed. There is actually no need to have this timer running because _nothing_ will happen until we have the gadget loaded. Also we need this timer only if we run in OTG mode _and_ we need it also after the gadget has been replaced with another one. I've been looking at am35x.c, da8xx.c, omap2430.c, tusb6010.c. da8xx seem to have the same problem as dsps and doing mostly the same thing. tusb6010 seem to do something different and do some actual "idle / power saving" work so I am not too comfortable to remove musb_platform_try_idle() from musb_gadget_setup(). Therefore this patch does not start the timer if there is no gadget active (which is at musb_gadget_setup() at time). In order to have the timer active after the gadget is loaded it will be triggered from dsps_musb_enable(). Cc: stable@vger.kernel.org # v3.11 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-11usb: Remove unnecessary semicolonsJoe Perches
These aren't necessary after switch and if blocks. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-01usb: musb_dsps: Remove redundant of_match_ptrSachin Kamat
The data structure of_match_ptr() protects is always compiled in. Hence of_match_ptr() is not needed. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Ravi B <ravibabu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: musb: dsps: do not bind to "musb-hdrc"Sebastian Andrzej Siewior
This went unnoticed in durin the merge window: The dsps driver creates a child device for the musb core driver _and_ attaches the of_node to it so devm_usb_get_phy_by_phandle() grabs the correct phy and attaches the devm resources to the proper device. We could also use the parent device but then devm would attach the resource to the wrong device and it would be destroyed once the parent device is gone - not the device that is used by the musb core driver. If the phy is now not available then dsps_musb_init() / devm_usb_get_phy_by_phandle() returns with EPROBE_DEFER. Since the of_node is attached it tries OF drivers as well and matches the driver against DSPS. That one creates a new child device for the musb core driver which gets probed immediately. The whole thing repeats itself until the stack overflows. I belive the same problem exists in ux500 glue code (since 313bdb11 ("usb: musb: ux500: add device tree probing support") but the drivers are now probed in the right order so they don't see it. The problem is that the dsps driver gets bound to the musb-child device due to the same of_node / matching binding. I don't really agree with having yet another child node in DT to fix this. Ideally we would have musb core driver with DT bindings and according to the binding we would select the few extra hacks / gleue layer. Therefore I suggest the driver to reject the musb-core device. Cc: Lee Jones <lee.jones@linaro.org> Tested-by: Tom Rini <trini@ti.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-27usb: musb: am335x-evm: Do not remove the session bit HOST-only modeSebastian Andrzej Siewior
This is what I observe: On the first connect, the musb starts with DEVCTL.Session set. On disconnect, musb_core calls try_idle. That functions removes the Session bit signalizing that the session is over (something that only in OTG is required). A new device, that is plugged, is no longer recognized. I've setup a timer and checked the DEVCTL register and I haven't seen a change in VBus and I saw the B-Device bit set. After setting the IDDIG into A mode and forcing the device to behave like a A device, I didn't see a change. Neither VBUS goes to 0b11 nor does a session start request comes. In the TI-v3.2 kernel they skip to call musb_platform_try_idle() in the OTG_STATE_A_WAIT_BCON state while not in OTG mode. Since the second port hast a standard A plug the patch changes the port to run in host mode only and skips the timer which would remove DEVCTL.Session so we can reconnect to another device later. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-27usb: musb: dsps: do not set is_active on the first drvbus interruptSebastian Andrzej Siewior
Quite early on init there is an vbus / drvvbus interrupt comming and the dsps code sets is_active to one. As a result we see a lot of |musb_bus_suspend 2459: trying to suspend as a_wait_bcon while active until a device is plugged in with pm_runtime enabled in the kernel. After checking davinci, am35, da8xx I noticed that dsps is actually the only one doing this. So remove it and we won't flooded with mesages and the idle port can be suspended. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>