From patchwork Fri Jan 13 14:58:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9515777 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 3334E601DA for ; Fri, 13 Jan 2017 14:58:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 275C528671 for ; Fri, 13 Jan 2017 14:58:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C436286D2; Fri, 13 Jan 2017 14:58:45 +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 7E5DA2868D for ; Fri, 13 Jan 2017 14:58:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751856AbdAMO6o (ORCPT ); Fri, 13 Jan 2017 09:58:44 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:36156 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751514AbdAMO6m (ORCPT ); Fri, 13 Jan 2017 09:58:42 -0500 Received: by mail-wm0-f48.google.com with SMTP id c85so68373922wmi.1 for ; Fri, 13 Jan 2017 06:58:42 -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=DAt6HeRK4wRASjpa23OPT0J0TBfpjy/MqvyO0LEuf38=; b=pMsZmCxlTzwBkjpt7F2aAMzI5DWrsXj+QXv+h64k8zKrp+sySydOBMQdOrtBXFT/uP GFBfHE620K9P2YODhhPgYOR4x/xIRMqHNyqCqz5UHKZ7iDuY+jb2zdZMwlftKqFf3+GU ER3FRU8ZBc7xgAk56ZQWHunKYol7HYgC/iAZS6rTPE0lDLRgNGYHa02rwDOa1NSl8ykb VTpf0ycJ5i1g8R8JCuOcy3Biuydnn9u3xpa7i1tNXguP9Bajz9QoEqAsnHJM+0M8tHpJ mWr8tcMKu9VjrbX8SfFTy3DFyCdxdQq7O7FjBc5+YLRrpdnqxJYzPEY2QXybDNetAxUJ iwhA== 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=DAt6HeRK4wRASjpa23OPT0J0TBfpjy/MqvyO0LEuf38=; b=Uz7qZQNk/wKQoXDbn5FP+xAvYLS2A2j78ctN/xKl0cSSVt+C5kEpf9g9Z4UrQ1LWkB Z4FpW4I8EUpFUG4GK2CfiOxk43upRhOxgzmITX//LEc6rI2Ipu73UiqENz0ZBF5Zmm3Z Eb21kJ98sp5+w8xDvQB3nI/I+5hvZwfjheuhi9C9IG4egkhDzEWPVkWhGG07Y9du54O0 h17Lt2yvspNCG9GxSZpEoeKlkE9lkutS/0MatwAnoZZY4nKxxbsX8O6Iu93x5nZbPmZb IBxh27DDoXCJvkEa23ujShPQm9bKUwlcYK02gQ8YSg6jqIkIgxLJTa4qKxsitiQcao8J nfNw== X-Gm-Message-State: AIkVDXJFCLGpXBOFWEsKXSRrvHodqxTdpF+UJbBXWEjCPecmc+omNQZy9Kng9lVRCv/QLaXY X-Received: by 10.28.169.135 with SMTP id s129mr2557052wme.24.1484319521304; Fri, 13 Jan 2017 06:58:41 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id e14sm4801258wmd.14.2017.01.13.06.58.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Jan 2017 06:58:40 -0800 (PST) From: Alexandre Bailon To: vinod.koul@intel.com Cc: dmaengine@vger.kernel.org, nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, tony@atomide.com, linux-omap@vger.kernel.org, b-liu@ti.com, sergei.shtylyov@cogentembedded.com, Alexandre Bailon Subject: [PATCH 2/3] usb: musb: cppi41: Detect aborted transfers in cppi41_dma_callback() Date: Fri, 13 Jan 2017 15:58:33 +0100 Message-Id: <20170113145834.23967-3-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170113145834.23967-1-abailon@baylibre.com> References: <20170113145834.23967-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 Update cppi41_dma_callback() to detect an aborted transfer. This is required to 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 d76022b..f182c07 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -101,7 +101,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) { @@ -156,7 +157,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); @@ -206,7 +207,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; @@ -223,6 +225,9 @@ static void cppi41_dma_callback(void *private_data) if (controller->dma_callback) controller->dma_callback(musb); + if (result->result == DMA_TRANS_ABORTED) + return; + spin_lock_irqsave(&musb->lock, flags); dmaengine_tx_status(cppi41_channel->dc, cppi41_channel->cookie, @@ -415,7 +420,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;