linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yegor Yefremov <yegorslists@googlemail.com>
To: Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org, vkoul@kernel.org,
	Bin Liu <b-liu@ti.com>, linux-usb <linux-usb@vger.kernel.org>,
	Andrey Skvortsov <andrej.skvortzov@gmail.com>,
	giulio.benetti@benettiengineering.com,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: Re: musb: cppi41: broken high speed FTDI functionality when connected to musb directly
Date: Mon, 30 Sep 2019 10:19:39 +0200	[thread overview]
Message-ID: <CAGm1_ktjndofS_N-qh7GVRuJFG1Jn87rf4D8Lt2XMj=+RrL2aw@mail.gmail.com> (raw)
In-Reply-To: <CAGm1_kvZpYH+NP8JfYJWE2v3E9v+yFs20L8MSKsAjfC_g+GmaQ@mail.gmail.com>

On Mon, Sep 30, 2019 at 8:59 AM Yegor Yefremov
<yegorslists@googlemail.com> wrote:
>
> On Sat, Sep 28, 2019 at 6:09 PM Yegor Yefremov
> <yegorslists@googlemail.com> wrote:
> >
> > On Fri, Sep 27, 2019 at 5:57 PM Tony Lindgren <tony@atomide.com> wrote:
> > >
> > > * Tony Lindgren <tony@atomide.com> [190927 15:20]:
> > > > * Yegor Yefremov <yegorslists@googlemail.com> [190927 12:31]:
> > > > > On Fri, Sep 27, 2019 at 10:18 AM Yegor Yefremov
> > > > > <yegorslists@googlemail.com> wrote:
> > > > > >
> > > > > > I was porting my system from 3.18/4.2 to 5.3. During this process I
> > > > > > noticed that FT4232 that is attached directly to musb is not working
> > > > > > correctly when opened for the first time: tx is working but nothing
> > > > > > can be received. On the second opening everything is working fine.
> > > > > > When the same chip is connected via a USB hub - everything is working
> > > > > > from the very beginning.
> > > > > >
> > > > > > I could reproduce this issue using BeagleBone Black with omap2plus_defconfig.
> > > > > >
> > > > > > # lsusb -t
> > > > > > +/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=musb-hdrc/1p, 480M
> > > > > >     |__ Port 1: Dev 2, If 0, Class=, Driver=ftdi_sio, 480M
> > > > > >     |__ Port 1: Dev 2, If 1, Class=, Driver=ftdi_sio, 480M
> > > > > >     |__ Port 1: Dev 2, If 2, Class=, Driver=ftdi_sio, 480M
> > > > > >     |__ Port 1: Dev 2, If 3, Class=, Driver=ftdi_sio, 480M
> > > > > >
> > > > > > git bisect revealed the following:
> > > > > >
> > > > > > fdea2d09b997ba4c86e7a707a5fac87c305f2131 is the first bad commit
> > > > > > commit fdea2d09b997ba4c86e7a707a5fac87c305f2131
> > > > > > Author: Tony Lindgren <tony@atomide.com>
> > > > > > Date:   Wed Aug 31 07:19:59 2016 -0700
> > > > > >
> > > > > >     dmaengine: cppi41: Add basic PM runtime support
> > > > > >
> > > > > >     Let's keep the device enabled between cppi41_dma_issue_pending()
> > > > > >     and dmaengine_desc_get_callback_invoke() and rely on the PM runtime
> > > > > >     autoidle timeout elsewhere.
> > > > > >
> > > > > >     As the PM runtime is for whole device, not for each channel,
> > > > > >     we need to queue pending transfers if the device is PM runtime
> > > > > >     suspended. Then we start the pending transfers in PM runtime
> > > > > >     resume.
> > > > > >
> > > > > >     Signed-off-by: Tony Lindgren <tony@atomide.com>
> > > > > >     Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> > > > > >
> > > > > > :040000 040000 8cf92c09083541dfdee01cc2973e73ef520f4fb1
> > > > > > a03c1a7ba8e723f7b503733c46edaa4141483265 M      drivers
> > > > > >
> > > > > > Any idea?
> > > > >
> > > > > The problems can be reproduced with other FTDI chips like FT232R.
> > > > >
> > > > > Invoking "minicom -D /dev/ttyUSB0" and typing some characters is
> > > > > enough to reproduce the issue (just in case, hw flow control should be
> > > > > disabled).
> > > > >
> > > > > cp210x based converter is working without an issue. So only FTDI chips
> > > > > are affected so far.
> > > >
> > > > Hmm OK. Maybe this could be an issue where the FTDI chip takes
> > > > longer to enumerate and cppi41 is already suspended by then?
> > > >
> > > > At least we had a similar issue with commit ae4a3e028bb8
> > > > ("dmaengine: cppi41: Fix runtime PM timeouts with USB mass
> > > > storage").
> > >
> > > Looks like I'm unable to reproduce this with bbb and FT232R
> > > USB UART.
> > >
> > > I tried v5.3 with omap2plus_defconfig, then boot, load musb
> > > and ftdi-sio modules, then connect ftdi directly to bbb,
> > > and then run "minicom -D /dev/ttyUSB0" on bbb and it works
> > > just fine for me.
> > >
> > > I tried also rebooting the device inbetween in case it only
> > > happens on the first connect after boot but still no luck
> > > reproducing.
> >
> > Strange. I've used a loopback to check whether the characters will be echoed.
> > FTDI cable was connected all the time so that I could check RX right after boot.
> > Both Buildroot and OpenWrt rootfs's showed this behaviour.
> >
> > > Maybe try adding some debug prints to cppi41_runtime_suspend()
> > > and cppi41_runtime_resume() to see if gets runtime suspended
> > > too early?
> >
> > Will do on Mo.
>
> I've added the printks to both routines and the result is quite
> interesting. On the system with a directly attached FTDI both routines
> will be always invoked before (resume) and after (suspend) the
> test/minicom i.e. during the USB initialization.
>
> On the systems with a USB hub, these routines will be invoked only
> during the USB initialization and the last invocation is resume.
> During the test, there are no invocations.

Removing PM routines workarounds the issue. Quick and dirty.

 static struct platform_driver cpp41_dma_driver = {
          .probe  = cppi41_dma_probe,
          .remove = cppi41_dma_remove,
          .driver = {
                  .name = "cppi41-dma-engine",
                  /*.pm = &cppi41_pm_ops,*/
                  .of_match_table = of_match_ptr(cppi41_dma_ids),
          },
  };

Yegor

  reply	other threads:[~2019-09-30  8:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-27  8:18 musb: cppi41: broken high speed FTDI functionality when connected to musb directly Yegor Yefremov
2019-09-27 12:30 ` Yegor Yefremov
2019-09-27 15:19   ` Tony Lindgren
2019-09-27 15:57     ` Tony Lindgren
2019-09-28 16:09       ` Yegor Yefremov
2019-09-30  6:59         ` Yegor Yefremov
2019-09-30  8:19           ` Yegor Yefremov [this message]
2019-09-30 14:57             ` Tony Lindgren
2019-09-30 15:23               ` Tony Lindgren
2019-09-30 19:54                 ` Sebastian Reichel
2019-10-01  8:03                   ` Johan Hovold
2019-10-01  9:19                     ` Yegor Yefremov
2019-10-01 16:43                       ` Tony Lindgren
2019-10-01 22:03                         ` Tony Lindgren
2019-10-02  6:56                           ` Yegor Yefremov
2019-10-02 16:52                             ` Tony Lindgren
2019-10-03  8:39                               ` Yegor Yefremov
2019-10-21  8:39                                 ` Yegor Yefremov
2019-10-22 14:56                                   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGm1_ktjndofS_N-qh7GVRuJFG1Jn87rf4D8Lt2XMj=+RrL2aw@mail.gmail.com' \
    --to=yegorslists@googlemail.com \
    --cc=andrej.skvortzov@gmail.com \
    --cc=b-liu@ti.com \
    --cc=bigeasy@linutronix.de \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tony@atomide.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).