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: 92424 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2143410qgi; Wed, 25 Jan 2017 02:33:39 -0800 (PST) X-Received: by 10.98.37.132 with SMTP id l126mr40093748pfl.45.1485340419766; Wed, 25 Jan 2017 02:33:39 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si22998087pfa.140.2017.01.25.02.33.39; Wed, 25 Jan 2017 02:33:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751918AbdAYKdh (ORCPT + 4 others); Wed, 25 Jan 2017 05:33:37 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35221 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751841AbdAYKd3 (ORCPT ); Wed, 25 Jan 2017 05:33:29 -0500 Received: by mail-wm0-f41.google.com with SMTP id r126so20017565wmr.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=iBVoT14jb1tSkQkhcJLAcaGNChTJajSxfFwPeKJV60OdzH+cRpsSof/F9D1KqHDQG0 zNLn1d4LlJ9NQRD2KtCARsCqhSptirX6PFGFtiql/nV/dnYRNXLCFMQq96AUWrxDs2Ux z8qk3cEI6QeH/7OXH2RaXCmXmScbfkblmoGmIV8uc0SihzfZYMSDoWxtdjLE/y1slYMb EQbeiDrhQ5x6YEXfLJmUrHj26d4Sgkmf/CnX3nuw75bnlGkeGDjKvPYHIOUBwtPh4fiX 6JjTyeGMzVkuIOjZ+GOjHnuqrPLtskscH2uvZpBcqz+2Hv0WP1xyfK651D5Mt7xH+47O QL6g== X-Gm-Message-State: AIkVDXI3D9FNkezkkSHEqrORj1RTtO3eN2FxTArVObES6QPvfF5aklWbuyYfUSrxnt8QQtfz 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-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;