From patchwork Mon Jan 9 16:39:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9505483 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 F1DDC60710 for ; Mon, 9 Jan 2017 16:39:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBE2E28494 for ; Mon, 9 Jan 2017 16:39:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D07742849A; Mon, 9 Jan 2017 16:39:18 +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 782FF2847F for ; Mon, 9 Jan 2017 16:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762684AbdAIQjQ (ORCPT ); Mon, 9 Jan 2017 11:39:16 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:35802 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762693AbdAIQjL (ORCPT ); Mon, 9 Jan 2017 11:39:11 -0500 Received: by mail-wm0-f44.google.com with SMTP id a197so103651068wmd.0 for ; Mon, 09 Jan 2017 08:39:10 -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=tcPJzUTpVgC7ZlbycOj2s8IAkl3gpKBlijVnRbiOhLw=; b=IDq0UpWWmj6n/apF55CIHAuyc0gNWcHlNMlgHXTPTqtQQ4yQKWkbU12j/0jcAOiUyg j9bv2sXSyBrwH4mnxhlPVbZeaIKlf5cxwr7imI7g6DoZABcj2l9LJP20bObH2J+NC+9e FWZ/Wk3AAQkbzEUV31PDwXtQjZ/ZbQj9ZdWEJQMqYtZq706xt4L2hXBMD5kE99GLX9f3 ynrLMvMFOgqr+235UT3kGF16gV0UiMI/wMPH+GMnDXpCdQ9/w2Q9vZd42KyUFLKYrHVx wn67nsCoJ8nYUepAqscyRiax5X9varyadj/3OeJ1zbGxKgpoI4awwevcroqTibWhmb8p XRPA== 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=tcPJzUTpVgC7ZlbycOj2s8IAkl3gpKBlijVnRbiOhLw=; b=rQDz0vRn8wSfJSfkNDdYTXv6TBtYimTVNA24YNHW4ZSpyqBmXBt9u2/0mVeiPX7ekP SnXAcdh8lysOylJUzIMBlIyME2aPYo2QKgfIWzgGmYiD6WOZXx1hplsqUit/WQQdiEjC Jg8+jdL1zqprI+RsB9/4PU0MQGYYordV7IC3fo5HM1hIvx0EyUMTPRm9LfTE8ZL/eJa5 fdGtQqLXnBm/ockrI819eGeB2I/x5FnNIUFwQ03741GiD484bfFPek1hxLXM3s7RItZt ZdvxYCQkH4DWTwNkMZfiKIsm8U9pJLyzTXJPoWP7q4Edyar2S/7jyz6nFlaVqUB4UHD4 C9QA== X-Gm-Message-State: AIkVDXLBwREjMCEjVRLqVQG6wTmxRTrnXiHl42GBvUUZkKgHLJge3gXNPOPW/+gFrYQE2UYb X-Received: by 10.28.15.2 with SMTP id 2mr3451924wmp.66.1483979949491; Mon, 09 Jan 2017 08:39:09 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id n5sm19733391wmf.0.2017.01.09.08.39.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Jan 2017 08:39:09 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: vinod.koul@intel.com, dmaengine@vger.kernel.org, linux-usb@vger.kernel.org, nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, tony@atomide.com, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org, david@lechnology.com, Alexandre Bailon Subject: [PATCH 4/4] usb: musb: musb_cppi41: Workaround dma stall issue during teardown Date: Mon, 9 Jan 2017 17:39:02 +0100 Message-Id: <20170109163902.5268-5-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170109163902.5268-1-abailon@baylibre.com> References: <20170109163902.5268-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 74dcc07..3513284 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -458,7 +458,7 @@ static inline u8 get_vbus_power(struct device *dev) } static const struct musb_platform_ops da8xx_ops = { - .quirks = MUSB_DMA_CPPI41 | MUSB_INDEXED_EP, + .quirks = MUSB_DMA_CPPI41 | MUSB_INDEXED_EP | 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 1636385..8fdbc17 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -547,6 +547,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;