From patchwork Tue Jan 17 14:35:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9521207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4AE3F60447 for ; Tue, 17 Jan 2017 14:35:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FE9227F80 for ; Tue, 17 Jan 2017 14:35:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3160028574; Tue, 17 Jan 2017 14:35:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF5462858A for ; Tue, 17 Jan 2017 14:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750949AbdAQOfq (ORCPT ); Tue, 17 Jan 2017 09:35:46 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:35458 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751388AbdAQOfl (ORCPT ); Tue, 17 Jan 2017 09:35:41 -0500 Received: by mail-wm0-f43.google.com with SMTP id r126so203357930wmr.0 for ; Tue, 17 Jan 2017 06:35:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IhGzjebBhI/AoXIZOC0k20QebcmCfoIi86o8oDmHiwM=; b=PO4lWF8rOBi3dOiCtpebv9CXv6uDslxwJFCUs4dYzZhpNjSbiNJdXb125Jr8cbc00I CZ00cahf8pDaiZZT1GJ8k07hJwk2YrSwkesvlrWHzvwOydmQx8OeEsaloHNbOBJKRdCh 1Zg3nePktwwfMTCO846OTsZhz2uN7E4uNlO9vJKpCa7urdt8ugzikMEcVGev19QUm9Gc xhwSChluxQaJTqOLsfvVpy6Dq96BGSZV540uKRXs259AAL/k7uZOkXx6UjoyXpLwrW70 42jXLjPDVcZrtHzsHINQtOpAHzmJtDGUPAwQkeyK+dk+coKDXW35uOZfy/XPXhPoXRx8 S7QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IhGzjebBhI/AoXIZOC0k20QebcmCfoIi86o8oDmHiwM=; b=X2VFGGTn0kRR9swAXOO4SeL2ovbLvcsiS5BiOmmxq+16gT7HKhyasPeiKlgmlY1xJK wnm3XykDri1Z8N7OUdBffCQj3ap4vFO5x4eAZRAQXJWD9T8hFIdu8n0WCqlhN4zhlnAF nalGMreS1dSapVwavzq2R2kenwljkEliHP4iP9SZCrfjIpIn7gtUZHtN3bIbNRe1EA6e 9DRdT9vTdor40Z8urEPO3Ig3yGUTSElA1JSWwjGY32cjpKnApRJ+XyAtbzxb4kvwuSAR s95CG9BO5HHiBDzlXXgqB5kPml3ymSUN/5LncCh56aRmdGv+BPZFS5cvwErjSBidcEx9 IExw== X-Gm-Message-State: AIkVDXJMYvuMRCLyvhA4hEUtfBD7upETS2xPL/d5PFrswONtD2a+LH8UTBb/iqpe62k3kQza X-Received: by 10.223.176.210 with SMTP id j18mr27790280wra.8.1484663739727; Tue, 17 Jan 2017 06:35:39 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id k11sm37394939wmb.18.2017.01.17.06.35.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 06:35:39 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: vinod.koul@intel.com, dmaengine@vger.kernel.org, nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, tony@atomide.com, linux-omap@vger.kernel.org, sergei.shtylyov@cogentembedded.com, Alexandre Bailon Subject: [PATCH v2 4/5] usb: musb: musb_cppi41: Workaround DMA stall issue during teardown Date: Tue, 17 Jan 2017 15:35:27 +0100 Message-Id: <20170117143528.11404-5-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117143528.11404-1-abailon@baylibre.com> References: <20170117143528.11404-1-abailon@baylibre.com> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The DMA may hung up if a teardown is initiated while an endpoint is still active (Advisory 2.3.27 of DA8xx errata). To workaround this issue, add a delay before to initiate the teardown. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/da8xx.c | 2 +- drivers/usb/musb/musb_core.h | 1 + drivers/usb/musb/musb_cppi41.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index be2d0eb..046356f 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -480,7 +480,7 @@ static void da8xx_dma_controller_callback(struct musb *musb) } static const struct musb_platform_ops da8xx_ops = { - .quirks = MUSB_INDEXED_EP | MUSB_DMA_CPPI41, + .quirks = MUSB_INDEXED_EP | MUSB_DMA_CPPI41 | MUSB_DA8XX, .init = da8xx_musb_init, .exit = da8xx_musb_exit, diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index ade902e..d129278 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -172,6 +172,7 @@ struct musb_io; */ struct musb_platform_ops { +#define MUSB_DA8XX BIT(7) #define MUSB_DMA_UX500 BIT(6) #define MUSB_DMA_CPPI41 BIT(5) #define MUSB_DMA_CPPI BIT(4) diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index f182c07..b9af602 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -566,6 +566,10 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel) } } + /* DA8xx Advisory 2.3.27: wait 250 ms before to start the teardown */ + if (musb->io.quirks & MUSB_DA8XX) + mdelay(250); + tdbit = 1 << cppi41_channel->port_num; if (is_tx) tdbit <<= 16;