From patchwork Fri Mar 24 14:35:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9642977 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 537D16020B for ; Fri, 24 Mar 2017 14:36:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4737F206AC for ; Fri, 24 Mar 2017 14:36:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BDE526E4C; Fri, 24 Mar 2017 14:36:39 +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 370DD206AC for ; Fri, 24 Mar 2017 14:36:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752285AbdCXOgg (ORCPT ); Fri, 24 Mar 2017 10:36:36 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:37432 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965818AbdCXOgd (ORCPT ); Fri, 24 Mar 2017 10:36:33 -0400 Received: by mail-wm0-f48.google.com with SMTP id n11so3923995wma.0 for ; Fri, 24 Mar 2017 07:36:32 -0700 (PDT) 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=krc33E8KSt7VQyF9yQWVEpjp6NEcib6l3M4f6P+//5U=; b=yaitVBMuchvCCtIMGR8095phuC3i6gJDCPRhh220O1pLGyc53As4/hU3HMoFTDvM7p eP4gNGoSXUqI/UAeZtrcaxsO4FFSceOT14AlmPhqkC8wokNxPkwRXP/vVaMvViqt0JQ4 qOvhQEYPs6+Bz3Ft6dDnKgWvgu1iOEK2NAu0JRVTTpjTRSbLFSo1t7uUBbXfulPSssqk mSnR7Kzfuxhx6R7whBOEVeomG5iplKL49raRXfCj8F4sNjPndtzRM5EiSK3jmcl8xK2f S4LUOnWpV/u9EXU3eRyetsPSLLPWG633ufrUb+87SiQWEtKZ9Cr4K6S86mFDpyKuIKR1 kJxg== 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=krc33E8KSt7VQyF9yQWVEpjp6NEcib6l3M4f6P+//5U=; b=GWqJoVznsmJbZJaHqh9YuTyCTQi5pjQCUbet41OkrrsqxTzJxI1MY9b69DGr21rVUT aE3Zr0eVpaF7vN1GZ0V/rRWxi+SH53paKg5TVZz0ANAouajgyRCgiydxCLu3knNcGpvv E17zKonPWYEyqDUrJq+zEwstrxa+JOvuBVlOMKJvLdBXCQqM0kHxl3jiYkRXZnFExS9p tIh/nb2MpoLfcumywU6JAlTxccR+oXcP1NWocj3DKLZg3sL0NLUsSnrZBT500hx9T5LD /3RyNOYOB2EfP1HJuaVusgT9hRo828J9FcraLmn0Mu9INAOcYR3Lpxcu44bBZh2C6eb8 A+Yw== X-Gm-Message-State: AFeK/H081hbzFd9DZQ5bY/YB2Gyz2sLGLbPW5AjcUpWmQe1LamT1/ZDp5QORCYJW2BSEG3b5 X-Received: by 10.28.130.81 with SMTP id e78mr3518716wmd.47.1490366191326; Fri, 24 Mar 2017 07:36:31 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id o2sm2665565wmb.28.2017.03.24.07.36.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Mar 2017 07:36:30 -0700 (PDT) From: Alexandre Bailon To: b-liu@ti.com Cc: linux-usb@vger.kernel.org, ptitiano@baylibre.com, khilman@baylibre.com, nsekhar@ti.com, tony@atomide.com, sergei.shtylyov@cogentembedded.com, linux-omap@vger.kernel.org, Alexandre Bailon Subject: [RESEND PATCH v6 3/4] usb: musb: musb_cppi41: Workaround DMA stall issue during teardown Date: Fri, 24 Mar 2017 15:35:59 +0100 Message-Id: <20170324143600.4704-4-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170324143600.4704-1-abailon@baylibre.com> References: <20170324143600.4704-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 458a499..ed28afd 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) static const struct musb_platform_ops da8xx_ops = { .quirks = MUSB_INDEXED_EP | MUSB_PRESERVE_SESSION | - MUSB_DMA_CPPI41, + 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 5b708be..3e98d42 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(8) #define MUSB_PRESERVE_SESSION BIT(7) #define MUSB_DMA_UX500 BIT(6) #define MUSB_DMA_CPPI41 BIT(5) diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 355655f..e7c8b1b 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -571,6 +571,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;