Skip to content
  1. Oct 18, 2013
  2. Oct 17, 2013
    • Sebastian Andrzej Siewior's avatar
      usb: musb: dsps: run the timer only on OTG systems · 24616eb6
      Sebastian Andrzej Siewior authored
      
      
      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: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      24616eb6
    • Sebastian Andrzej Siewior's avatar
      usb: musb: dsps: redo the otg timer · 0f901c98
      Sebastian Andrzej Siewior authored
      
      
      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: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      0f901c98
    • Sebastian Andrzej Siewior's avatar
      usb: musb: dsps: remove declartion for dsps_musb_try_idle() · 807d0d2b
      Sebastian Andrzej Siewior authored
      
      
      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: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      807d0d2b
    • Sebastian Andrzej Siewior's avatar
      usb: musb: dsps: move try_idle to start hook · 8b9fcce2
      Sebastian Andrzej Siewior authored
      
      
      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: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      8b9fcce2
    • Sebastian Andrzej Siewior's avatar
      usb: musb: call musb_start() only once in OTG mode · ae44df2e
      Sebastian Andrzej Siewior authored
      In commit 001dd84a
      
       ("usb: musb: start musb on the udc side, too") it was
      ensured that the state engine is started also in OTG mode after a
      removal / insertion of the gadget.
      Unfortunately this change also introduced a bug: If the device is
      configured as OTG and it connected with a remote host _without_ loading
      a gadget then we bug() later (because musb->otg->gadget is not
      initialized).
      Initially I assumed it might be nice to have the host part of musb in
      OTG mode working without having a gadget loaded. This bug and fact that
      it wasn't working like this before the host/gadget split made me realize
      that this was a silly idea.
      This patch now introduces back the old behavior where in OTG mode the
      host mode is only working after the gadget has been loaded.
      
      Cc: stable@vger.kernel.org # v3.11
      Cc: Daniel Mack <zonque@gmail.com>
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      ae44df2e
  3. Oct 15, 2013
  4. Oct 12, 2013
  5. Oct 11, 2013
    • Robert Baldyga's avatar
      usb: gadget: s3c-hsotg: remove unused label · 7eb581d5
      Robert Baldyga authored
      
      
      This patch removes unused label.
      
      Signed-off-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      7eb581d5
    • Robert Baldyga's avatar
      usb: gadget: s3c-hsotg: add multi count support · 4fca54aa
      Robert Baldyga authored
      
      
      This patch adds Multi Count support. It adds few modifications:
      - Fix s3c_hsotg_set_ep_maxpacket() function. Field wMaxPacketSize of endpoint
        descriptor is now splitted into maximum packet size value and number of
        additional transaction per microframe.
      - Modify s3c_hsotg_write_fifo() function. It actually calculates transfer
        size, taking into account Multi Count value, which indicates number of
        transactions per microframe.
      - Fix s3c_hsotg_start_req() function by setting number of packets to Multi
        Count field in DIEPTSIZ register for isochronous endpoints.
      
      Signed-off-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      4fca54aa
    • Robert Baldyga's avatar
      usb: gadget: s3c-hsotg: add isochronous transfers support · 1479e841
      Robert Baldyga authored
      
      
      This patch adds isochronous transfer support. It adds few modifications:
      - Modify s3c_hsotg_epint() function. Some interrupts are ignored for
        isochronous endpoints, (e.g. INTknTXFEmpMsk) becouse isochronous request is
        always transfered in single transaction, which ends with XferCompl interrupt.
      - Add Odd/Even microframe toggle to allow data transfering in each microframe
        in s3c_hsotg_epint() function.
      - Fix s3c_hsotg_ep_enable() function by supporting isochronous endpoint type.
      
      Signed-off-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      1479e841
    • Felipe Balbi's avatar
      usb: dwc3: core: use pm_runtime_put_sync() on remove · 16b972a5
      Felipe Balbi authored
      
      
      We are going to disable runtime_pm and we're
      removing the driver, we must disable the device
      now.
      
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      16b972a5
    • Valentine Barshak's avatar
      usb: phy: Add RCAR Gen2 USB phy · 5578b266
      Valentine Barshak authored
      
      
      This adds RCAR Gen2 USB phy support. The driver configures
      USB channels 0/2 which are shared between PCI USB hosts and
      USBHS/USBSS devices. It also controls internal USBHS phy.
      
      Signed-off-by: default avatarValentine Barshak <valentine.barshak@cogentembedded.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      5578b266
    • Sebastian Andrzej Siewior's avatar
      usb: musb: cancel work on removal · c5340bd1
      Sebastian Andrzej Siewior authored
      
      
      So I captured this:
      
      |WARNING: CPU: 0 PID: 2078 at /home/bigeasy/work/new/TI/linux/lib/debugobjects.c:260 debug_print_object+0x94/0xc4()
      |ODEBUG: free active (active state 0) object type: work_struct hint: musb_irq_work+0x0/0x38 [musb_hdrc]
      |CPU: 0 PID: 2078 Comm: rmmod Not tainted 3.12.0-rc4+ #338
      |[<c0014d38>] (unwind_backtrace+0x0/0xf4) from [<c001249c>] (show_stack+0x14/0x1c)
      |[<c001249c>] (show_stack+0x14/0x1c) from [<c0037720>] (warn_slowpath_common+0x64/0x84)
      |[<c0037720>] (warn_slowpath_common+0x64/0x84) from [<c00377d4>] (warn_slowpath_fmt+0x30/0x40)
      |[<c00377d4>] (warn_slowpath_fmt+0x30/0x40) from [<c022ae90>] (debug_print_object+0x94/0xc4)
      |[<c022ae90>] (debug_print_object+0x94/0xc4) from [<c022b7e0>] (debug_check_no_obj_freed+0x1c0/0x228)
      |[<c022b7e0>] (debug_check_no_obj_freed+0x1c0/0x228) from [<c00f1f38>] (kfree+0xf8/0x228)
      |[<c00f1f38>] (kfree+0xf8/0x228) from [<c02921c4>] (release_nodes+0x1a8/0x248)
      |[<c02921c4>] (release_nodes+0x1a8/0x248) from [<c028f70c>] (__device_release_driver+0x98/0xf0)
      |[<c028f70c>] (__device_release_driver+0x98/0xf0) from [<c028f840>] (device_release_driver+0x24/0x34)
      |[<c028f840>] (device_release_driver+0x24/0x34) from [<c028ebe8>] (bus_remove_device+0x148/0x15c)
      |[<c028ebe8>] (bus_remove_device+0x148/0x15c) from [<c028d120>] (device_del+0x104/0x1c0)
      |[<c028d120>] (device_del+0x104/0x1c0) from [<c02911e4>] (platform_device_del+0x18/0xac)
      |[<c02911e4>] (platform_device_del+0x18/0xac) from [<c029179c>] (platform_device_unregister+0xc/0x18)
      |[<c029179c>] (platform_device_unregister+0xc/0x18) from [<bf1902fc>] (dsps_remove+0x20/0x4c [musb_dsps])
      |[<bf1902fc>] (dsps_remove+0x20/0x4c [musb_dsps]) from [<c0290d7c>] (platform_drv_remove+0x1c/0x24)
      |[<c0290d7c>] (platform_drv_remove+0x1c/0x24) from [<c028f704>] (__device_release_driver+0x90/0xf0)
      |[<c028f704>] (__device_release_driver+0x90/0xf0) from [<c028f818>] (driver_detach+0xb4/0xb8)
      |[<c028f818>] (driver_detach+0xb4/0xb8) from [<c028e6e8>] (bus_remove_driver+0x98/0xec)
      |[<c028e6e8>] (bus_remove_driver+0x98/0xec) from [<c008fc70>] (SyS_delete_module+0x1e0/0x24c)
      |[<c008fc70>] (SyS_delete_module+0x1e0/0x24c) from [<c000e680>] (ret_fast_syscall+0x0/0x48)
      |---[ end trace d79045419a3e51ec ]---
      
      The workqueue is only scheduled from the ep0 and never canceled in case
      the musb is removed before the work has a chance to run.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      c5340bd1
  6. Oct 10, 2013