From patchwork Thu Jan 19 10:06:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9525381 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 8F87160113 for ; Thu, 19 Jan 2017 10:07:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81589283C9 for ; Thu, 19 Jan 2017 10:07:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7614F284F7; Thu, 19 Jan 2017 10:07:26 +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=unavailable 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 024CD283C9 for ; Thu, 19 Jan 2017 10:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751417AbdASKHT (ORCPT ); Thu, 19 Jan 2017 05:07:19 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38735 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751525AbdASKHO (ORCPT ); Thu, 19 Jan 2017 05:07:14 -0500 Received: by mail-wm0-f51.google.com with SMTP id r144so69174375wme.1 for ; Thu, 19 Jan 2017 02:07:14 -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=I4iSOS6MeQOdGQog0c/+3dGHuJCe5kI/aKAcAfYBY4H26SXro5lC6uJw+dZhwR9ooZ zeO7hJKuTNlMtr/i67/3b7JkZ/B1imKvEh/RaqzIqC9ZChltAY/rH9446dK6wYgtanN4 UpQY05ghvF0FFv9KKeOlHJz4f+5xqg4l6yG5FUfrLxLHzJbaSsqv11iz9qnEcK34KipQ WTH8Lc8LldV4jWQBf8w0b57utdm+Wwoj+9LMlvKe9iXvOLtpAfl8qpRhIpV6SWKC3wdd hJpfZKcoHrem+JR/YglXB4IvE8mzE7hVyl4LDdwxMdMOHvwNJSLuuFeMMLCIfhY3Zm6L 9NSg== 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=CJUPAslIS2XICNeMXAlZJ0DI7MyTSGJWoy62z3chNfaxO5BtE7QuPrVKyoikaE/d8O 3tQon9lHC/DToPo3JMbDzfVSdHdf7uV0kuePTuW/lt2fIiJ8po2vX4iFJj/3coFua5TB 9vjRU7G8QDeJXVQe3lnpHPLzSP6j9CbQ6K2yO2TSQWRDSbcfDeSnRHrOUTwJYKOLLp34 vqzuJ2E5unFmItftNykaj85GwbPwymHf5B+ipHq9XNfTnpjDcTArCc9jiZgoHa3Clumr yy0+CcmVsyPLUqlRTH/ZAitzWjQjMAmvwVj7WZK1ySAoalzJTrulsr8IOikmtkqNPL89 2UWQ== X-Gm-Message-State: AIkVDXKoZ1CRMon1Y0Airb07BgTmT25bzhmNdbhYAZei3VrwKQU+ummQrJYQD1b/0InernpN X-Received: by 10.223.177.130 with SMTP id q2mr6800329wra.39.1484820433326; Thu, 19 Jan 2017 02:07:13 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id w197sm11703194wmd.11.2017.01.19.02.07.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 02:07:12 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: vinod.koul@intel.com, 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, grygorii.strashko@ti.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v3 2/3] usb: musb: cppi41: Detect aborted transfers in cppi41_dma_callback() Date: Thu, 19 Jan 2017 11:06:58 +0100 Message-Id: <20170119100659.11370-3-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170119100659.11370-1-abailon@baylibre.com> References: <20170119100659.11370-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 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(-) 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;