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: 9505481 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 DCC2660710 for ; Mon, 9 Jan 2017 16:39:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6F872847F for ; Mon, 9 Jan 2017 16:39:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAE5828494; Mon, 9 Jan 2017 16:39:17 +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 636722847F for ; Mon, 9 Jan 2017 16:39:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762696AbdAIQjQ (ORCPT ); Mon, 9 Jan 2017 11:39:16 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:36314 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762689AbdAIQjL (ORCPT ); Mon, 9 Jan 2017 11:39:11 -0500 Received: by mail-wm0-f47.google.com with SMTP id c85so103433357wmi.1 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=TcUwA5FgS6WPfF/3A6wjzl64A5yWN6L3drkzwlNXUa+pkvQ7N+QWr5TiXKGhfzVcaU 1JgGuaKPTNpj5vygoWuu/qLrMYMBoaSRAzVfKm61FfnUXrd673FZ1CnO81hQ9lvyaV2m zr9RE3G6xMRl7Bo2ZmOtx1ie8h6GsGZg623FpgG8nKWupS3+01PShRn2jPpxyk85alOS +JALNRtrWf3J4nlX4wQKVxq6vrcdyZdqEg6baAtrlvMm6H2ZkXefu1fAFBvXm9LxoteK 0LgxRY3f2W7vQoMzEVkE8Oc05h8G5RPVOzhvaTtT0vFYlZYZhguwpFI+SXKKJh+mcg/g HqLg== X-Gm-Message-State: AIkVDXLUEg3J3ha3ZmxfD8aUc3aSePs/7Vc2jthI48GTIJAlrx2P89grOE3TGhvDTLBC35kv 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: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@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;