From patchwork Thu Jan 19 10:06:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91845 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp200665qgi; Thu, 19 Jan 2017 02:07:18 -0800 (PST) X-Received: by 10.99.65.67 with SMTP id o64mr9134867pga.119.1484820438311; Thu, 19 Jan 2017 02:07:18 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e11si3077429pgp.204.2017.01.19.02.07.18; Thu, 19 Jan 2017 02:07:18 -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 S1751440AbdASKHP (ORCPT + 4 others); Thu, 19 Jan 2017 05:07:15 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:36253 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751444AbdASKHN (ORCPT ); Thu, 19 Jan 2017 05:07:13 -0500 Received: by mail-wm0-f47.google.com with SMTP id c85so281782677wmi.1 for ; Thu, 19 Jan 2017 02:07:13 -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=v5Nt4/XC946+k57XQM7zDMScdlFDIlHVXq3iLX8LI78=; b=UpuZLKigJHTb4gF8YV58/ZC24K39YAW8y5XZ8RP/kGZHVf1eg2hksetCxzzbdlmFT3 8kcfL1SJPTAle+1Ks+wKC7rG3wJZiVtTqQJHxsq8koLC2xLUzAqo4wIcYJzVpSgNciAn Vyj9eWaZsFHV9iJeZAzKoy+XNX6T1LqDp9PmHHXXErEG+VUHr8G549HA7b4ce9J5sW9A yb82K3yz6nFnZfQsj+m/C0BqFLJNqmpFG+hsTIRja6XPFyz2OTyRQNmtBp3mVTHOZJ0c 3uOKRLU/+TjWOAa+VCSpelLDaLzkNqWU8jddWr41scJqmV6hKnV34lpFoXgiS7jDOu1r Vjpw== 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=v5Nt4/XC946+k57XQM7zDMScdlFDIlHVXq3iLX8LI78=; b=inUBWYFVe9UtvrDu1F/J365h2r20aedBrlXvsGJQvC1pcQRxTRJ2wG4FELqpdMgKsd a4Lys0+Fv5FtXFyM39iwilplpNxQGCU4WrkbnPTppzuwyzIlmv71olvWmfe6tshovV7Q PH4TPDX7HV0bmNCOJkX5T27pIJPh6rMGJRAJDO01CQGROKpKQgKOych7bC2rTPmsF0MS 3IFqEzhdrwA4cAjiS2if59wqMpbOhhsJfppMtsk2rUDhJhXaB7LhMCFkgqhCu8sRtA+v tMVr7bF6eqG7i0eqOgpaWIKuwTQSMeW4UnS2u4+nQW89sUsBVNtkJ4cfZgSazxwcvDwA UaAQ== X-Gm-Message-State: AIkVDXJqWJ2hmEphv2DhbygnMZynuWBtmbz+UaGwe+fmRBa6+2IEml7aoRmB7oI9Mfs6675c X-Received: by 10.28.222.11 with SMTP id v11mr23196942wmg.1.1484820432417; Thu, 19 Jan 2017 02:07:12 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id w197sm11703194wmd.11.2017.01.19.02.07.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 02:07:11 -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 1/3] usb: musb: dma: Add a DMA completion platform callback Date: Thu, 19 Jan 2017 11:06:57 +0100 Message-Id: <20170119100659.11370-2-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-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Currently, the CPPI 4.1 driver is not completely generic and only work on dsps. This is because of IRQ management. Add a callback to dma_controller that could be invoked on DMA completion to acknodlege the IRQ. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/musb_cppi41.c | 7 +++++-- drivers/usb/musb/musb_dma.h | 4 ++++ 2 files changed, 9 insertions(+), 2 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 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..8bea0cd 100644 --- a/drivers/usb/musb/musb_dma.h +++ b/drivers/usb/musb/musb_dma.h @@ -181,10 +181,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 + * @platform_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 +199,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 */