From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD5D9C352AA for ; Wed, 2 Oct 2019 16:52:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB46421920 for ; Wed, 2 Oct 2019 16:52:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727970AbfJBQwY (ORCPT ); Wed, 2 Oct 2019 12:52:24 -0400 Received: from muru.com ([72.249.23.125]:35130 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726076AbfJBQwY (ORCPT ); Wed, 2 Oct 2019 12:52:24 -0400 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 66A7D80E1; Wed, 2 Oct 2019 16:52:55 +0000 (UTC) Date: Wed, 2 Oct 2019 09:52:19 -0700 From: Tony Lindgren To: Yegor Yefremov Cc: Johan Hovold , Sebastian Reichel , linux-omap@vger.kernel.org, vkoul@kernel.org, Bin Liu , linux-usb , Andrey Skvortsov , giulio.benetti@benettiengineering.com, Sebastian Andrzej Siewior , Peter Ujfalusi Subject: Re: musb: cppi41: broken high speed FTDI functionality when connected to musb directly Message-ID: <20191002165219.GL5610@atomide.com> References: <20190930145711.GG5610@atomide.com> <20190930152330.GH5610@atomide.com> <20190930195411.6porqtm7tlokgel3@earth.universe> <20191001080339.GF13531@localhost> <20191001164351.GJ5610@atomide.com> <20191001220321.GK5610@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org * Yegor Yefremov [191002 06:57]: > On Wed, Oct 2, 2019 at 12:03 AM Tony Lindgren wrote: > > The other way to fix this would be to just wake up cpp41 in > > cppi41_dma_prep_slave_sg() and return NULL so that we can > > have musb_ep_program() continue with PIO while cppi41 is > > asleep. > > > > Anyways, care to try it out and see if it fixes your issue? > > The fix is working but on the first invocation, I get this output > (minicom provokes the same output): > # serialtest.py -c 2 /dev/ttyUSB0 /dev/ttyUSB0 ... > [ 210.940612] [] (__rpm_callback) from [] > (rpm_callback+0x20/0x80) > [ 210.948402] [] (rpm_callback) from [] > (rpm_resume+0x468/0x7a0) > [ 210.956018] [] (rpm_resume) from [] > (__pm_runtime_resume+0x4c/0x64) > [ 210.964086] [] (__pm_runtime_resume) from [] > (cppi41_dma_prep_slave_sg+0x20/0xfc [cppi41]) OK so that won't work, thanks for testing. Here's the alternative patch to try along the lines described above that just wakes up cppi41 and returns NULL so musb_ep_program() can continue with PIO until cppi41 is awake. Regards, Tony 8< ----------------------- diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c --- a/drivers/dma/ti/cppi41.c +++ b/drivers/dma/ti/cppi41.c @@ -586,9 +586,22 @@ static struct dma_async_tx_descriptor *cppi41_dma_prep_slave_sg( enum dma_transfer_direction dir, unsigned long tx_flags, void *context) { struct cppi41_channel *c = to_cpp41_chan(chan); + struct dma_async_tx_descriptor *txd = NULL; + struct cppi41_dd *cdd = c->cdd; struct cppi41_desc *d; struct scatterlist *sg; unsigned int i; + int error; + + error = pm_runtime_get(cdd->ddev.dev); + if (error < 0) { + pm_runtime_put_noidle(cdd->ddev.dev); + + return NULL; + } + + if (cdd->is_suspended) + goto err_out_not_ready; d = c->desc; for_each_sg(sgl, sg, sg_len, i) { @@ -611,7 +624,13 @@ static struct dma_async_tx_descriptor *cppi41_dma_prep_slave_sg( d++; } - return &c->txd; + txd = &c->txd; + +err_out_not_ready: + pm_runtime_mark_last_busy(cdd->ddev.dev); + pm_runtime_put_autosuspend(cdd->ddev.dev); + + return txd; } static void cppi41_compute_td_desc(struct cppi41_desc *d) -- 2.23.0