From patchwork Wed Jan 25 10:33:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9536743 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 B26FB6046A for ; Wed, 25 Jan 2017 10:33:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A022F26861 for ; Wed, 25 Jan 2017 10:33:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 933DF2787C; Wed, 25 Jan 2017 10:33:41 +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=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 13FD426861 for ; Wed, 25 Jan 2017 10:33:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751777AbdAYKdh (ORCPT ); Wed, 25 Jan 2017 05:33:37 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:35220 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751852AbdAYKd3 (ORCPT ); Wed, 25 Jan 2017 05:33:29 -0500 Received: by mail-wm0-f54.google.com with SMTP id r126so20017567wmr.0 for ; Wed, 25 Jan 2017 02:33:29 -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=y0oRiK2gyAECtFsmUvACCWrht8NI+9nroAEJ42d/HqM=; b=p4KqljQ5T5AYCDuj8pUY4g7hYlqEA50NdeYRBcUldzGqWE6nmthRxi7GsULHi4W8WH Q6ofIscl/CaoBTDvIL76zwOV+J2Z62bZKZfsPsSYKukFJj3p3OXdIdXi/rEvG/zTRn3G 6NTzzCujjTD+NjOGFq61WEbmUkAyxOc1zNB7as/vlg/MCeFSnhLkCs1PXu6L1IGHbNRl H6pFNcmDMovx3vslbqmDZ3meWmSbNwQAtqPevhYUraLSZoNg3/9ie3BCEw9FdjDZIWT9 4YNP2Cnm6U8MJE7VdNIr4TcvDV0dMNAqDcD8QAZJF2haCmVp8h1f8RQJP8qC88C7jQyP 47xg== 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=y0oRiK2gyAECtFsmUvACCWrht8NI+9nroAEJ42d/HqM=; b=EdtHtrjq7OPCM8LDudCDWCi/oI6wHcKlR5O1ZeGZu82Ya+qxpM1sbE0q6jyqwFB1g3 gBHNh8EdiF8uiOSIrn71jaOuUwysbc13IHXvt8PvEG7bHaPsVBQEIifIosit5/7oHr+u lRvCh5EGKeFbiRdX3zoZO8NVcPypCWxTx/MwwSYGoVXVVSMPfM6nhEWB8WwXCXnnIxIV BLVEmt1LAy8FgpzJ1qB++h2gwl1lkqwfXgL99HoBXFovbnuJq/oxGSBH9WW2LdW5rX/w 5xO8Ybxbtm+Xubgvs7XWP/Ilt3GkhpgejLxR42D3JwhgeJXSKi2ay+tP3kvMSstTAH+J lbuA== X-Gm-Message-State: AIkVDXKVXSV5QBjLTmBPENQyupfHhyYNqTkk66uMx5pttJZlfNHcHBZ6rJpv6t4+QmoglSf5 X-Received: by 10.223.155.221 with SMTP id e29mr33156612wrc.107.1485340408417; Wed, 25 Jan 2017 02:33:28 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z134sm30599521wmc.20.2017.01.25.02.33.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 02:33:27 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, tony@atomide.com, linux-omap@vger.kernel.org, sergei.shtylyov@cogentembedded.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v5 4/5] usb: musb: musb_cppi41: Workaround DMA stall issue during teardown Date: Wed, 25 Jan 2017 11:33:18 +0100 Message-Id: <20170125103319.26021-5-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170125103319.26021-1-abailon@baylibre.com> References: <20170125103319.26021-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 hang 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 d279438..d87fb9b 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -483,7 +483,7 @@ da8xx_dma_controller_create(struct musb *musb, void __iomem *base) #endif 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 00e272b..2df37be 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -552,6 +552,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;