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: 9521211 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 6E847601C3 for ; Tue, 17 Jan 2017 14:35:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 663B927F80 for ; Tue, 17 Jan 2017 14:35:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B0A328574; Tue, 17 Jan 2017 14:35:53 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable 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 EF6B427F80 for ; Tue, 17 Jan 2017 14:35:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751400AbdAQOft (ORCPT ); Tue, 17 Jan 2017 09:35:49 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:33365 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751393AbdAQOfq (ORCPT ); Tue, 17 Jan 2017 09:35:46 -0500 Received: by mail-wm0-f48.google.com with SMTP id d140so21366885wmd.0 for ; Tue, 17 Jan 2017 06:35:45 -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=BFTtMCtEHE+jgpzAOs2F9XC5335m3CYm+4FRmSASTZ33QgYRDrUBcTnEy+8Ht4mCL1 pmynnEz4tvJKOODQLkYDeoTaJs5aGuUunWbasTMCcCM93v1aePXG451dXt6QWzHqYCVE 6OYSFYbeaC/LZT0DKWs0Va1xz5geKN7R3YmcLUCsV58zyw9Q8WCa5v3S3OdmrG92uT99 iR27HGyYfx6cv8cE4wy9nrfR9knzlY1YNzpRuIXDHU0VciU+k2WI2+/u1SobOxCa33DQ GsvcsTCtqbl8m9WD9j3yM5TNO9jKv21YdwKWTwE6q3H5NuGBQldx7/4Rrn8ZFwxDB3No akaQ== X-Gm-Message-State: AIkVDXI8jusjNuEcYGy7XD01L+6CRfAUrriGyEBF3GbKKry9UIgtdNv9gZxmEVYxDR8WHbT4 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: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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;