From patchwork Thu Jan 19 14:08:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9525921 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 514A56020B for ; Thu, 19 Jan 2017 14:08:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43082283BA for ; Thu, 19 Jan 2017 14:08:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37BAD28501; Thu, 19 Jan 2017 14:08:56 +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 AB9D5283BA for ; Thu, 19 Jan 2017 14:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752887AbdASOIx (ORCPT ); Thu, 19 Jan 2017 09:08:53 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:33959 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752718AbdASOIp (ORCPT ); Thu, 19 Jan 2017 09:08:45 -0500 Received: by mail-wm0-f48.google.com with SMTP id f73so6105287wmf.1 for ; Thu, 19 Jan 2017 06:08: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=brn296tbhyqIZBTNK2gXtMyRJPKNh2Tu45s9F47VjuE=; b=HiP9tnLMZ5tP7y96lq8NWrUTys+QRPbokls67fjfy2TfetViG1eCSXi7CClPvu8o2f 3TUlR8phR8Rrg6UdjyHkDWT3CTEbopMaCkfWrTSLI87ZDeKPLQI/uCoBAbK5AmHLXUfX cQXo8iqhTOFerApoqTMQkc3F6YHfCE7oBEQwGSWW9COllDQzu+Rf03Wz2cFPwZ/0btnb yOxKdDCZ7Xi7C5j5NTjXy5i1a1wfxSJ4s8DIVD5j+kT2g/g14/w9TqtVy4NoU/7DLmUc elRCOnrcjN3DF/O5JzkJ00ddsaqw00G+dNcKO3VdlMgX5BH0QVJaEW4h8LOVNAxm2ZFJ Ju6Q== 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=brn296tbhyqIZBTNK2gXtMyRJPKNh2Tu45s9F47VjuE=; b=WP8XsL5rucdFAg3B9+AbHuaUlFUK9/TBFWDRvJLjdSwsGIE1cFguQkSpTctPRWzETW GSbvcUse08tf7Xn1pKg+/x4hVSrB3F7JCo3r04WXrKCfU1MUYwlRIbCZMpISqQezkqFV hwhtsUNjg3UZAtxe0+asem8QYGXMbtwGrtJKvnpgy0gNCCsUcZbQgB96/VgyW+v6BkKV FYwxj1Q8BbDpCDobdzDGPSM4yJqRueU2m0sLoCgN/auu2ju5djwQcc5h+JLunwmdnHUg YUzbT6+4zegFi29H0JsYIgj3baksAqWaoXi0zmrLC6ZlbaS8rihI7tb0PwHCmm4HfZZQ 9Ufg== X-Gm-Message-State: AIkVDXKEtPjgm8HN8RJ+FTAyoyJs1t6fXFQ81/31ktYKNoh+gC/T5WoeLHAlgmtLro3RfIII X-Received: by 10.223.177.130 with SMTP id q2mr7783675wra.39.1484834924470; Thu, 19 Jan 2017 06:08:44 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id d64sm53546626wmh.3.2017.01.19.06.08.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 06:08:43 -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, grygorii.strashko@ti.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v3 4/5] usb: musb: musb_cppi41: Workaround DMA stall issue during teardown Date: Thu, 19 Jan 2017 15:08:34 +0100 Message-Id: <20170119140835.18981-5-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170119140835.18981-1-abailon@baylibre.com> References: <20170119140835.18981-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 5f50a78..8c9850c 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 1fe7eae..d371d05 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -554,6 +554,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;