From patchwork Wed Jan 25 10:17:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92409 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2138252qgi; Wed, 25 Jan 2017 02:17:26 -0800 (PST) X-Received: by 10.99.209.85 with SMTP id c21mr25123755pgj.147.1485339446050; Wed, 25 Jan 2017 02:17:26 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o9si15810362pgi.274.2017.01.25.02.17.25; Wed, 25 Jan 2017 02:17:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751797AbdAYKRX (ORCPT + 4 others); Wed, 25 Jan 2017 05:17:23 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38365 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751640AbdAYKRU (ORCPT ); Wed, 25 Jan 2017 05:17:20 -0500 Received: by mail-wm0-f51.google.com with SMTP id r144so22066180wme.1 for ; Wed, 25 Jan 2017 02:17:19 -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=l0diVk/x0C2hYHFgAMLCYylYsi9Eg2+NcvKNdF3Dt7A=; b=OqK2+b2ivheycGydpWwX640zan7Vs/9qHGNfjdsLBGLyZNBIJsQmmrvGlg2mUVXemc Sov5pwLiB3MZ+Idw4d1mHNOxxf9pp+2dwOO7r4WFUcEb8YYZSCS8L7X/bn0Y4gufR8AG ISzQcpYC46BAUGo3KnwXRFcVN+9FPwoiireIklqd259vgjYXFNDkMuUfSDrGTcwVs43v sBAofQr+R7cqNtCsNkvv2s6Ohi8+1EW9LnGxctK9auzrDKKppXnMXri5MrvZlYM5TM3E pPRfU/O+FdG8oLk3P/1vIg0UyBPZWCGeDjnmo14B+XsHibPykPrvqYp/DubHE3pPK+Bq wy6A== 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=l0diVk/x0C2hYHFgAMLCYylYsi9Eg2+NcvKNdF3Dt7A=; b=plyxASWk1YZqz2LU+toiCIXmAaoxvaz6xYllSRDmlSQ3y+XLHYpZZNJy0rlCuLRN4A D72XT813SzC7nXvBgqM9KnagzENfqSZZ2TgGiEcSvo71hNGs8mhTf+5X+q1GVFK3uGUY bGfzTsVm2tAK75qwrT9MpEg9+DO5UxouCYjD0saNJzjVvcCl8yH/PVNzGLbWNor5t+3p jDYlEephfDTYrmpDiMIuyiHOc0HLiIxiF9evnyp7XUdQod1v7hmT4VEC9r5go9ZhtGlC 0UPKDi9wXwwIS8/eTZDhF11wiAv7oxb9Uxg8FKIhuhzhy61+uNgEhYWm7Qhds3xUioy1 xgOQ== X-Gm-Message-State: AIkVDXLXwIdeFpLhKpD2roFzssGk/bpD3nyqPhBKIaBIhTuFdXRMDRHKdbR+zDoEk33KDXX6 X-Received: by 10.28.174.208 with SMTP id x199mr23760382wme.107.1485339439030; Wed, 25 Jan 2017 02:17:19 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id t123sm6483045wmt.8.2017.01.25.02.17.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 02:17:18 -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 1/6] usb: musb: dma: Add a DMA completion platform callback Date: Wed, 25 Jan 2017 11:17:04 +0100 Message-Id: <20170125101709.15696-2-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-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Currently, the CPPI 4.1 driver is not completely generic and only works on DSPS. This is because of IRQ management. Add a callback to dma_controller that could be invoked on DMA completion to acknowledge the IRQ. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/musb_cppi41.c | 7 +++++-- drivers/usb/musb/musb_dma.h | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" 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 1636385..f7d3d27 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -217,6 +217,10 @@ static void cppi41_dma_callback(void *private_data) int is_hs = 0; bool empty; + controller = cppi41_channel->controller; + if (controller->controller.dma_callback) + controller->controller.dma_callback(&controller->controller); + spin_lock_irqsave(&musb->lock, flags); dmaengine_tx_status(cppi41_channel->dc, cppi41_channel->cookie, @@ -249,8 +253,6 @@ static void cppi41_dma_callback(void *private_data) * We spin on HS (no longer than than 25us and setup a timer on * FS to check for the bit and complete the transfer. */ - controller = cppi41_channel->controller; - if (is_host_active(musb)) { if (musb->port1_status & USB_PORT_STAT_HIGH_SPEED) is_hs = 1; @@ -695,6 +697,7 @@ cppi41_dma_controller_create(struct musb *musb, void __iomem *base) controller->controller.channel_program = cppi41_dma_channel_program; controller->controller.channel_abort = cppi41_dma_channel_abort; controller->controller.is_compatible = cppi41_is_compatible; + controller->controller.musb = musb; ret = cppi41_dma_controller_start(controller); if (ret) diff --git a/drivers/usb/musb/musb_dma.h b/drivers/usb/musb/musb_dma.h index 46357e1..04c3bd8 100644 --- a/drivers/usb/musb/musb_dma.h +++ b/drivers/usb/musb/musb_dma.h @@ -173,6 +173,7 @@ dma_channel_status(struct dma_channel *c) /** * struct dma_controller - A DMA Controller. + * @musb: the usb controller * @start: call this to start a DMA controller; * return 0 on success, else negative errno * @stop: call this to stop a DMA controller @@ -181,10 +182,13 @@ dma_channel_status(struct dma_channel *c) * @channel_release: call this to release a DMA channel * @channel_abort: call this to abort a pending DMA transaction, * returning it to FREE (but allocated) state + * @dma_callback: invoked on DMA completion, useful to run platform + * code such IRQ acknowledgment. * * Controllers manage dma channels. */ struct dma_controller { + struct musb *musb; struct dma_channel *(*channel_alloc)(struct dma_controller *, struct musb_hw_ep *, u8 is_tx); void (*channel_release)(struct dma_channel *); @@ -196,6 +200,7 @@ struct dma_controller { int (*is_compatible)(struct dma_channel *channel, u16 maxpacket, void *buf, u32 length); + void (*dma_callback)(struct dma_controller *); }; /* called after channel_program(), may indicate a fault */