From patchwork Wed Mar 29 16:24:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9651929 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 4A2EA601D7 for ; Wed, 29 Mar 2017 16:25:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C8A128482 for ; Wed, 29 Mar 2017 16:25:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3157B284F6; Wed, 29 Mar 2017 16:25:34 +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 8BEE928482 for ; Wed, 29 Mar 2017 16:25:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753152AbdC2QZc (ORCPT ); Wed, 29 Mar 2017 12:25:32 -0400 Received: from mail-wr0-f171.google.com ([209.85.128.171]:34474 "EHLO mail-wr0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753060AbdC2QZa (ORCPT ); Wed, 29 Mar 2017 12:25:30 -0400 Received: by mail-wr0-f171.google.com with SMTP id l43so23054495wre.1 for ; Wed, 29 Mar 2017 09:25:29 -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=qNd8/CrZazbbrqXb1RNBJUUoi5Fn0HaNDEu0bSZSOMs=; b=mHfWeV3EGO4c6Kb7PCFKHqyf/RadeqD5HuKxzeWkMRuAmJolSQRd2Nb08rDaMEAyOc PgRguPH9uf0Vy/tnPWtviSabFWOOPmuv1fCKnue+mYoee8uBASH5VUduVIg32QrXisrx m5N3DlLvdh0uWSliPyqC5TT8WdOFMDN6MdG/YgZMzrRnm7bIbXl0bNRU1t1aHzn3MjpY opqziZv/aeEL+4gnt5bWW5rzvsbnHOR5BikVI83VYQyUdVIlpDhanDOLvIjJNLeB1fSy 05HWWGkyE6NJyw7VSCvRGu5JnfujWrBYvc9fQN62eKXjpgIJy+OnO2ayzm/LrIymN2Zk 5AXQ== 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=qNd8/CrZazbbrqXb1RNBJUUoi5Fn0HaNDEu0bSZSOMs=; b=l28u9/a8itC2PIG/jsvtKZunC6lTFNmRpNVvdJVF52pTeb4RhQZ88PWylqZJFPduPo 6JTuHKwQcWfJH/l4IlSuIpxB/51+a7zaMiuJYQIfgCmWlIA4BXzClVaLmuaWbGzvf6ez QW8tUPWW0KLFS76fQE9hCfL+71ww/NK7gR4hjORX8stOmxYCWJRbyQVV3k3tuerX+xsO U49fcnxVY5L7zRXEKmT29eq2CQt7N5nbBL8YZI3RAnNafQ/3jKn9fIENg9scSRUY8fIl 6qAIiPb1IBx+GsH8rpBvjhDAFKSEpyXi6YwvlmPG+TR2gxQDodBaozskhyRR5+1e9Cm0 eZbQ== X-Gm-Message-State: AFeK/H063BeLIT0xkjD0Q94X7zUsLn41QoRmt6hw/lusq0l3bvAxxFgdaXwdScT/Gmeh51We X-Received: by 10.223.143.53 with SMTP id p50mr1278980wrb.2.1490804728338; Wed, 29 Mar 2017 09:25:28 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id h3sm10041926wrb.6.2017.03.29.09.25.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Mar 2017 09:25:27 -0700 (PDT) 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, grygorii.strashko@ti.com, Alexandre Bailon Subject: [PATCH v7 3/3] usb: musb: musb_cppi41: Workaround DMA stall issue during teardown Date: Wed, 29 Mar 2017 18:24:32 +0200 Message-Id: <20170329162432.27299-4-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170329162432.27299-1-abailon@baylibre.com> References: <20170329162432.27299-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 7b9a44d..5a8a031 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;