From patchwork Wed Feb 15 14:26:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9574199 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 D72E260209 for ; Wed, 15 Feb 2017 14:27:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C910027D16 for ; Wed, 15 Feb 2017 14:27:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC79B27FB0; Wed, 15 Feb 2017 14:27:13 +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 3ED6727E5A for ; Wed, 15 Feb 2017 14:27:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751108AbdBOO1J (ORCPT ); Wed, 15 Feb 2017 09:27:09 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:36945 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751063AbdBOO1G (ORCPT ); Wed, 15 Feb 2017 09:27:06 -0500 Received: by mail-wm0-f50.google.com with SMTP id v77so41642335wmv.0 for ; Wed, 15 Feb 2017 06:27:05 -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=QvKrkyqdOodaGDrd0Bv5Wv/Bfi92hi4TQFaRc6ZwcrI=; b=HNtfdh5gusP/FusYFZNV0fH8ubdQEW3A+wBNrVIIAlCAQmqSuISivR5akRjdhaG+wO bQ8Btm8UgXR/R5nf0E4pT0qaN+GDHYVYfDvKw8XNXWZyHl9BtSzu2eJ84Frrafc7N4t6 WlvxgFVkQp9UJ5YqykX726R77FrlC8ut7ALSPFHQwo2Ch59b/m7Ude0zMvePoGyULlMo WfUWqXoXLo8N4zrOvZL5J3SidadrMYFnrmdSjJU8jkuwqKrDSM+4ZB9W0O3Hd4zOFyXL B1T3/JWuO03VfXXYY2HXJpETdS+BCtx829LiJ9uJphcvf6/4EQPL3uGcrVYlgaadWlG6 s5DA== 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=QvKrkyqdOodaGDrd0Bv5Wv/Bfi92hi4TQFaRc6ZwcrI=; b=Cus7SRntKZr4uvwF0eIMGcJFnWp9QzhN29T45fQxKbS6ueGGsLO2va5WNqJXgg4AU7 jxwdJBxfs4KD7J4OvzBYvE7Bgz2QAQ64UvUcNhVjaQKJizvRfzpIwaIUZNJssp9M+b9k bFbI97RzdOqg9nnVpR3/CFUpeUi5vuBGvPJnmMNXStM9BzakERIxEGo6A6M3dlAfJykG axWUl/4JR4Y+ywCJx2a0w4mEES9uXlVQPR9hN83CyAKmqGO9GinxhQ9XmY6ydWHLdIfh XFnmATUZpNrujMo2UenJJg3m3XQXL0qeVMMv/wMMLt5uhPANZv+IQ4GiC65Yko0bcKiT JB+Q== X-Gm-Message-State: AMke39m6Rq4EzJ/aYH4E76gF17x3wNQqHfeN4xle+1Cmy44b+18xkHEay/QoAhOS+4Nf8VBp X-Received: by 10.28.130.207 with SMTP id e198mr8141215wmd.4.1487168824864; Wed, 15 Feb 2017 06:27:04 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z90sm5127419wrc.24.2017.02.15.06.27.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Feb 2017 06:27:04 -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 v6 3/4] usb: musb: musb_cppi41: Workaround DMA stall issue during teardown Date: Wed, 15 Feb 2017 15:26:56 +0100 Message-Id: <20170215142657.31571-4-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170215142657.31571-1-abailon@baylibre.com> References: <20170215142657.31571-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 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;