From patchwork Tue Jan 24 10:11:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9534743 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 7A442601D3 for ; Tue, 24 Jan 2017 10:12:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69B3624DA2 for ; Tue, 24 Jan 2017 10:12:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C8BC26AE3; Tue, 24 Jan 2017 10:12:05 +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 0DB7C24DA2 for ; Tue, 24 Jan 2017 10:12:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750883AbdAXKMC (ORCPT ); Tue, 24 Jan 2017 05:12:02 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:33233 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750862AbdAXKL7 (ORCPT ); Tue, 24 Jan 2017 05:11:59 -0500 Received: by mail-wm0-f48.google.com with SMTP id d140so41387925wmd.0 for ; Tue, 24 Jan 2017 02:11:58 -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=WcC5Xn5sSMdLuBaZQgCYrEBJ+tpOnl93Rz1hI2Mrvns=; b=xtdNx5revvFQPuoEyTsrekZXngaREoQqIQ6rF/VbQ4GuXrYee2QiXsYBSpZbpWFPrH kU3fh7Q3eVgvgdgG25Ci4xm8q4EpWwPvLV9wkOi0Dr2S8oTO00phfWLeJOOEuzkOOYa6 rvfKyWQEElAX7npvb2uff3y9msRBYYAA5Qmq8VtZRLg01GwHDnKEd0m9+8xMU5wT1mD0 JqrKIOISYQnSkkf7NmypXF8RyVNUJOU36PwPB7PFU9fwu3WZmBauv0150qj3V41JqazW 6mSbac1pDshYjFfbVqK9EEG0ar6WDahMkHMYBH5bUSTQsm0VqtBQrGR17RpZxiXHEdub zqyA== 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=WcC5Xn5sSMdLuBaZQgCYrEBJ+tpOnl93Rz1hI2Mrvns=; b=tnM/t89EFbEyeYb0b2z44qwq/DmHF5TqDyGYUjVYixbomDdn352hyEI3+m4vBjkUcK InTw5kyXsgfRPrMM7IfIYcDhW+GkiJBAHernad+lMDUFYax0J0ms0JZVBQyoqP33BUug 69TlauIM93H8xwpa9KwPbHfMCoEcQ3+cq7u/1n3Z1NmBfpl4Y0vXBWJQ9qzNv89oyZm8 KUiIMLowHh5mYJGwLe5T19GZk0KvRnWAZd44SzxGcZYLwgbEQlE9UDzZWqh4f52dgq2I 9pctM2B5mt73+/f9HVlGJTsj9Qt8T3JvZKEjokB1/RSM589gM2quvNpIwYMp79UocNhG P1sw== X-Gm-Message-State: AIkVDXIZBMqKX+UtIqWW3KJssJJgC5h6u+QqI1vEa+fnpBaC/tj4fRgu9whik0Pgp9xUU+DV X-Received: by 10.223.168.111 with SMTP id l102mr27102937wrc.150.1485252717917; Tue, 24 Jan 2017 02:11:57 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c81sm25427318wmf.22.2017.01.24.02.11.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 02:11:57 -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, linux-usb@vger.kernel.org, sergei.shtylyov@cogentembedded.com, Alexandre Bailon Subject: [PATCH v4 4/5] usb: musb: musb_cppi41: Workaround DMA stall issue during teardown Date: Tue, 24 Jan 2017 11:11:48 +0100 Message-Id: <20170124101149.14920-5-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170124101149.14920-1-abailon@baylibre.com> References: <20170124101149.14920-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 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 7253ea1..2fb2b81 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -553,6 +553,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;