From patchwork Wed Jan 25 10:17:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92414 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2138416qgi; Wed, 25 Jan 2017 02:17:54 -0800 (PST) X-Received: by 10.98.217.209 with SMTP id b78mr45398291pfl.53.1485339474039; Wed, 25 Jan 2017 02:17:54 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si22932850pfe.63.2017.01.25.02.17.53; Wed, 25 Jan 2017 02:17:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751777AbdAYKRv (ORCPT + 4 others); Wed, 25 Jan 2017 05:17:51 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:37517 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751681AbdAYKRW (ORCPT ); Wed, 25 Jan 2017 05:17:22 -0500 Received: by mail-wm0-f50.google.com with SMTP id c206so22115531wme.0 for ; Wed, 25 Jan 2017 02:17:21 -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=M3JGUCPukR36GxqCxOt+9YFra680uwO0q/ypxhNKYh4=; b=NB9SGAJth5Dx2PONCu+97p04bcxI91zB/K5ULYOJ0DP+7SDsfy95H/wX35P1jCBGo1 ImpZBTwVRaZDT97x248/FcwzSwyhfe91rV5AhD27j84E9t/t3mDlVUaUcw5BhphA8TVL WzaV/huw9mLbmYe3X5DX1Bzigc0V6rO9bpNOyzmVAz+hutzYnfED6hSX3BhNYyGuKi9v FZFcpTcPS/3vThAFeiUYBgsEaXDQ/kIZsm9ld2QcAu+rX64L4vlvTJg2QTPWN8mk6a9F oPalfuYCn8WkQwhWmr1U4f16ktHKJY7vEkTKjAFaXlw6dXyf7grSnxIzpk7ZNIlOxLwz Rsqw== 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=M3JGUCPukR36GxqCxOt+9YFra680uwO0q/ypxhNKYh4=; b=bSJfezfKrJoaAtaiE1qHi09tkQ94v/S+3l2SyTKRczw0yNFMFaoGO1qzSSam8vMapM +3kjCXUwKGlwNxjnhCVKR6s0ks4t3/BFi8oDR+GEBKFdvmNapR0h49hEkKom10DC+nVS fUE5QRLbbAztNw3EUfz8Mjy5SLQEFFrbxgniLKf9oVfcL2f+Nv92kz9UVsJStuRfu2/H D2PA6obUm9G8KdF2tY6yXVTTb6I3WlTYrzDK8kIOO+7lNMg3vuOjLNwBKSsWudI/Kdp/ JmvU5S18B3FgZAUQsVrLT4mPC9hWuc+FvCTAzpunpi2nbYVeqnyuAaBJQVD57C+P5/Zl GrUw== X-Gm-Message-State: AIkVDXKQ70dzDqHSxzsb3hGrEUj8mAIYXz5Nihux/Nbjt9Lv8uqExH5Ed1QecsHF19ZsAW0l X-Received: by 10.28.130.212 with SMTP id e203mr20529831wmd.104.1485339441062; Wed, 25 Jan 2017 02:17:21 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id t123sm6483045wmt.8.2017.01.25.02.17.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 02:17:20 -0800 (PST) From: Alexandre Bailon To: vinod.koul@intel.com, b-liu@ti.com Cc: dmaengine@vger.kernel.org, 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 v5 2/6] usb: musb: cppi41: Detect aborted transfers in cppi41_dma_callback() Date: Wed, 25 Jan 2017 11:17:05 +0100 Message-Id: <20170125101709.15696-3-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170125101709.15696-1-abailon@baylibre.com> References: <20170125101709.15696-1-abailon@baylibre.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Update cppi41_dma_callback() to detect an aborted transfer. This was not required before because cppi41_dma_callback() was only invoked on transfer completion. In order to make CPPI 4.1 driver more generic, cppi41_dma_callback() will be invoked after a transfer abort in order to let the MUSB driver perform some action such as acknowledge the interrupt that may be fired during a teardown. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/musb_cppi41.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index f7d3d27..1fe7eae 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -99,7 +99,8 @@ static bool musb_is_tx_fifo_empty(struct musb_hw_ep *hw_ep) return true; } -static void cppi41_dma_callback(void *private_data); +static void cppi41_dma_callback(void *private_data, + const struct dmaengine_result *result); static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) { @@ -154,7 +155,7 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) if (WARN_ON(!dma_desc)) return; - dma_desc->callback = cppi41_dma_callback; + dma_desc->callback_result = cppi41_dma_callback; dma_desc->callback_param = &cppi41_channel->channel; cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); trace_musb_cppi41_cont(cppi41_channel); @@ -204,7 +205,8 @@ static enum hrtimer_restart cppi41_recheck_tx_req(struct hrtimer *timer) return ret; } -static void cppi41_dma_callback(void *private_data) +static void cppi41_dma_callback(void *private_data, + const struct dmaengine_result *result) { struct dma_channel *channel = private_data; struct cppi41_dma_channel *cppi41_channel = channel->private_data; @@ -221,6 +223,9 @@ static void cppi41_dma_callback(void *private_data) if (controller->controller.dma_callback) controller->controller.dma_callback(&controller->controller); + if (result->result == DMA_TRANS_ABORTED) + return; + spin_lock_irqsave(&musb->lock, flags); dmaengine_tx_status(cppi41_channel->dc, cppi41_channel->cookie, @@ -403,7 +408,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel, if (!dma_desc) return false; - dma_desc->callback = cppi41_dma_callback; + dma_desc->callback_result = cppi41_dma_callback; dma_desc->callback_param = channel; cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); cppi41_channel->channel.rx_packet_done = false;