From patchwork Tue Jan 17 13:45:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91650 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp498715qgi; Tue, 17 Jan 2017 05:53:00 -0800 (PST) X-Received: by 10.99.56.94 with SMTP id h30mr24582824pgn.23.1484661180728; Tue, 17 Jan 2017 05:53:00 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si25008640plm.337.2017.01.17.05.53.00; Tue, 17 Jan 2017 05:53:00 -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 S1751167AbdAQNw5 (ORCPT + 4 others); Tue, 17 Jan 2017 08:52:57 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:35197 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751100AbdAQNwy (ORCPT ); Tue, 17 Jan 2017 08:52:54 -0500 Received: by mail-wm0-f44.google.com with SMTP id r126so201570783wmr.0 for ; Tue, 17 Jan 2017 05:51:54 -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=q2NL+bi0peA+W7j8XaoEWpJ3Dd0spQTD0P4xYm4tN9o=; b=PgGZrppY48XRWXAgW91BNPYdpF6zpJJ5ImkQtKy8XmbyBnrQk9hhL5NifMOfqoUGr8 uL/WAPeO3HMQS1P5Z4ZNKly4aAKd8T3LXFDADf6Xm/Rake91V6EB99SYN9aD0HurS8op w7yK8jqZWWGvZCW+o8BPI+CuZBxbKNg4md2VIxXyjB0GFBuNc5o1Ats0V981YZ9N+L+Z XaEThyKYX+rfYhIt5xDf8XC1MaojgfYZjZXQdSSQUMOszwRMFufhFJTB2tBWy9csrJ0z tEBpYQEUcs5UB/2DFxyrAq4GxubFHgGJQ8UZ7mhX4Y+5WZZAU0NGtRlo7wAc99YrQieH nxYw== 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=q2NL+bi0peA+W7j8XaoEWpJ3Dd0spQTD0P4xYm4tN9o=; b=U06cFN+Qc2EtaHV07badxHoVTCq6iJnd2yf1VBBe9QQTKW6CoASMiM6CujUNKfLF4T gpfZhR31JcqNn1dE83yqCUxWKAVrSbJenaFtheWX6a5P2EwqKzLsOcilmbrJlNanWHkl YUOfR413sFiatGsK7weag21/xzxBiZsvqEHvfzl1HMKatIgBcuicoDLCzRteUs1r/gSQ ZEnyUreg7DC4qmz+uKI7IqvwtmF/cmbtYLiXQkyoY/yoDYsilb3GesjBUwxUf7n2cs1K A0Vbt3mxPWyHdjq1ItTKjhBTeOsQinvuMoPBd4qDEDzXz3U9xWR0bR/iseWtTUlaOyi3 EX+A== X-Gm-Message-State: AIkVDXJ0zbVL7ji0FOmWE5OjRr+wytq/kFBVc9OAaLJ+7HE8kczLqEpGSebrJsJuqyKUVBYP X-Received: by 10.28.15.2 with SMTP id 2mr17972592wmp.66.1484660749331; Tue, 17 Jan 2017 05:45:49 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l187sm37064811wml.6.2017.01.17.05.45.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 05:45:48 -0800 (PST) From: Alexandre Bailon To: vinod.koul@intel.com, b-liu@ti.com, robh+dt@kernel.org 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, devicetree@vger.kernel.org, Alexandre Bailon Subject: [PATCH v2 1/7] usb: musb: dsps: Manage CPPI 4.1 DMA interrupt in dsps Date: Tue, 17 Jan 2017 14:45:34 +0100 Message-Id: <20170117134540.9988-2-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117134540.9988-1-abailon@baylibre.com> References: <20170117134540.9988-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Despite the CPPI 4.1 is a generic DMA, it is tied to USB. On the dsps, CPPI 4.1 interrupt's registers are in USBSS (the MUSB glue). Currently, to enable / disable and clear interrupts, the CPPI 4.1 driver maps and accesses to USBSS's register, which making CPPI 4.1 driver not really generic. Move the interrupt management to dsps driver. Signed-off-by: Alexandre Bailon --- drivers/dma/cppi41.c | 28 +++++------------ drivers/usb/musb/musb_dsps.c | 73 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 78 insertions(+), 23 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/dma/cppi41.c b/drivers/dma/cppi41.c index d5ba43a..4999e7d 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -79,14 +79,6 @@ #define QMGR_QUEUE_C(n) (0x2008 + (n) * 0x10) #define QMGR_QUEUE_D(n) (0x200c + (n) * 0x10) -/* Glue layer specific */ -/* USBSS / USB AM335x */ -#define USBSS_IRQ_STATUS 0x28 -#define USBSS_IRQ_ENABLER 0x2c -#define USBSS_IRQ_CLEARR 0x30 - -#define USBSS_IRQ_PD_COMP (1 << 2) - /* Packet Descriptor */ #define PD2_ZERO_LENGTH (1 << 19) @@ -288,14 +280,8 @@ static irqreturn_t cppi41_irq(int irq, void *data) { struct cppi41_dd *cdd = data; struct cppi41_channel *c; - u32 status; int i; - status = cppi_readl(cdd->usbss_mem + USBSS_IRQ_STATUS); - if (!(status & USBSS_IRQ_PD_COMP)) - return IRQ_NONE; - cppi_writel(status, cdd->usbss_mem + USBSS_IRQ_STATUS); - for (i = QMGR_PENDING_SLOT_Q(FIST_COMPLETION_QUEUE); i < QMGR_NUM_PEND; i++) { u32 val; @@ -599,6 +585,7 @@ static void cppi41_compute_td_desc(struct cppi41_desc *d) static int cppi41_tear_down_chan(struct cppi41_channel *c) { + struct dmaengine_result abort_result; struct cppi41_dd *cdd = c->cdd; struct cppi41_desc *td; u32 reg; @@ -682,6 +669,12 @@ static int cppi41_tear_down_chan(struct cppi41_channel *c) c->td_seen = 0; c->td_desc_seen = 0; cppi_writel(0, c->gcr_reg); + + /* Invoke the callback to do the necessary clean-up */ + abort_result.result = DMA_TRANS_ABORTED; + dma_cookie_complete(&c->txd); + dmaengine_desc_get_callback_invoke(&c->txd, &abort_result); + return 0; } @@ -1044,8 +1037,6 @@ static int cppi41_dma_probe(struct platform_device *pdev) goto err_irq; } - cppi_writel(USBSS_IRQ_PD_COMP, cdd->usbss_mem + USBSS_IRQ_ENABLER); - ret = devm_request_irq(&pdev->dev, irq, glue_info->isr, IRQF_SHARED, dev_name(dev), cdd); if (ret) @@ -1069,7 +1060,6 @@ static int cppi41_dma_probe(struct platform_device *pdev) dma_async_device_unregister(&cdd->ddev); err_dma_reg: err_irq: - cppi_writel(0, cdd->usbss_mem + USBSS_IRQ_CLEARR); cleanup_chans(cdd); err_chans: deinit_cppi41(dev, cdd); @@ -1097,7 +1087,6 @@ static int cppi41_dma_remove(struct platform_device *pdev) of_dma_controller_free(pdev->dev.of_node); dma_async_device_unregister(&cdd->ddev); - cppi_writel(0, cdd->usbss_mem + USBSS_IRQ_CLEARR); devm_free_irq(&pdev->dev, cdd->irq, cdd); cleanup_chans(cdd); deinit_cppi41(&pdev->dev, cdd); @@ -1116,7 +1105,6 @@ static int __maybe_unused cppi41_suspend(struct device *dev) struct cppi41_dd *cdd = dev_get_drvdata(dev); cdd->dma_tdfdq = cppi_readl(cdd->ctrl_mem + DMA_TDFDQ); - cppi_writel(0, cdd->usbss_mem + USBSS_IRQ_CLEARR); disable_sched(cdd); return 0; @@ -1142,8 +1130,6 @@ static int __maybe_unused cppi41_resume(struct device *dev) cppi_writel(QMGR_SCRATCH_SIZE, cdd->qmgr_mem + QMGR_LRAM_SIZE); cppi_writel(0, cdd->qmgr_mem + QMGR_LRAM1_BASE); - cppi_writel(USBSS_IRQ_PD_COMP, cdd->usbss_mem + USBSS_IRQ_ENABLER); - return 0; } diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 9f125e1..2a20eef 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -121,6 +121,7 @@ struct dsps_glue { struct timer_list timer; /* otg_workaround timer */ unsigned long last_timer; /* last timer data for each instance */ bool sw_babble_enabled; + void __iomem *usbss_base; struct dsps_context context; struct debugfs_regset32 regset; @@ -145,6 +146,13 @@ static const struct debugfs_reg32 dsps_musb_regs[] = { { "mode", 0xe8 }, }; +/* USBSS / USB AM335x */ +#define USBSS_IRQ_STATUS 0x28 +#define USBSS_IRQ_ENABLER 0x2c +#define USBSS_IRQ_CLEARR 0x30 + +#define USBSS_IRQ_PD_COMP (1 << 2) + /** * dsps_musb_enable - enable interrupts */ @@ -619,14 +627,68 @@ static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) } } +static void dsps_dma_controller_callback(struct musb *musb); + +static struct dma_controller * +dsps_dma_controller_create(struct musb *musb, void __iomem *base) +{ + struct dma_controller *controller; + struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); + void __iomem *usbss_base = glue->usbss_base; + + controller = cppi41_dma_controller_create(musb, base); + if (!IS_ERR_OR_NULL(controller)) { + musb_writel(usbss_base, USBSS_IRQ_ENABLER, USBSS_IRQ_PD_COMP); + cppi41_register_dma_callback(controller, + dsps_dma_controller_callback); + } + + return controller; +} + +static void dsps_dma_controller_destroy(struct dma_controller *c) +{ + struct musb *musb = cppi41_dma_controller_to_musb(c); + struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); + void __iomem *usbss_base = glue->usbss_base; + + musb_writel(usbss_base, USBSS_IRQ_CLEARR, USBSS_IRQ_PD_COMP); + cppi41_dma_controller_destroy(c); +} + +static void dsps_dma_controller_suspend(struct dsps_glue *glue) +{ + void __iomem *usbss_base = glue->usbss_base; + + musb_writel(usbss_base, USBSS_IRQ_CLEARR, USBSS_IRQ_PD_COMP); +} + +static void dsps_dma_controller_resume(struct dsps_glue *glue) +{ + void __iomem *usbss_base = glue->usbss_base; + + musb_writel(usbss_base, USBSS_IRQ_ENABLER, USBSS_IRQ_PD_COMP); +} + +static void dsps_dma_controller_callback(struct musb *musb) +{ + struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); + void __iomem *usbss_base = glue->usbss_base; + u32 status; + + status = musb_readl(usbss_base, USBSS_IRQ_STATUS); + if (status & USBSS_IRQ_PD_COMP) + musb_writel(usbss_base, USBSS_IRQ_STATUS, USBSS_IRQ_PD_COMP); +} + static struct musb_platform_ops dsps_ops = { .quirks = MUSB_DMA_CPPI41 | MUSB_INDEXED_EP, .init = dsps_musb_init, .exit = dsps_musb_exit, #ifdef CONFIG_USB_TI_CPPI41_DMA - .dma_init = cppi41_dma_controller_create, - .dma_exit = cppi41_dma_controller_destroy, + .dma_init = dsps_dma_controller_create, + .dma_exit = dsps_dma_controller_destroy, #endif .enable = dsps_musb_enable, .disable = dsps_musb_disable, @@ -792,6 +854,9 @@ static int dsps_probe(struct platform_device *pdev) glue->dev = &pdev->dev; glue->wrp = wrp; + glue->usbss_base = of_iomap(pdev->dev.parent->of_node, 0); + if (!glue->usbss_base) + return -ENXIO; platform_set_drvdata(pdev, glue); pm_runtime_enable(&pdev->dev); @@ -880,6 +945,8 @@ static int dsps_suspend(struct device *dev) glue->context.tx_mode = musb_readl(mbase, wrp->tx_mode); glue->context.rx_mode = musb_readl(mbase, wrp->rx_mode); + dsps_dma_controller_suspend(glue); + return 0; } @@ -893,6 +960,8 @@ static int dsps_resume(struct device *dev) if (!musb) return 0; + dsps_dma_controller_resume(glue); + mbase = musb->ctrl_base; musb_writel(mbase, wrp->control, glue->context.control); musb_writel(mbase, wrp->epintr_set, glue->context.epintr); From patchwork Tue Jan 17 13:45:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91654 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp498797qgi; Tue, 17 Jan 2017 05:53:12 -0800 (PST) X-Received: by 10.98.141.194 with SMTP id p63mr27867668pfk.185.1484661192539; Tue, 17 Jan 2017 05:53:12 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si3430770pfb.281.2017.01.17.05.53.12; Tue, 17 Jan 2017 05:53:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751204AbdAQNw6 (ORCPT + 7 others); Tue, 17 Jan 2017 08:52:58 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:36776 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751124AbdAQNwy (ORCPT ); Tue, 17 Jan 2017 08:52:54 -0500 Received: by mail-wm0-f43.google.com with SMTP id c85so200832669wmi.1 for ; Tue, 17 Jan 2017 05:52: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 :mime-version:content-transfer-encoding; bh=j/Hshz2GlgToHA8WAqK13oQ+r95M7A29RUpbqkqL9B4=; b=YV7zbWaGii7LTBaNbgBxJuEgENTrAfQ07zCu7OuU/b1Rf+pmmhgkN0Vo5hrS7cqD3c ugrXxjYn9q5TMssxkI2x21/u/oSBuEklobttTPmlV7TKZ3c49sGlLUQCnIl81eHujd3K BMcx4+sG/kW/OOjt6VJWZKul51w4vACHV1Jr8hNcUitnKQ1cwHLXM5eckgxpWskRHchj VmTsoIQL271pZUqmfsmE2rz4r4hezqnzluQnBuo65mvg4mbmpolEPqt5+641XnKZuGUF L5eVbr0yU9nJoX+sRzsrAIE709qQ6b26l8ZmbJla5Xp928Nz+TVeHF73iun2dHZ7BXZV Pqcg== 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:mime-version:content-transfer-encoding; bh=j/Hshz2GlgToHA8WAqK13oQ+r95M7A29RUpbqkqL9B4=; b=c0L3jT8xZZxktD9kwQLfWtIBDZIk1M3k9C0WHCEDa0+3P+mA6tr2SxatTz12KDhSgY LYmwBvXa0l5X8+Yeg4ZKO2zQdqjrNSa0WBI8w0ujwussCwWQpyBfjayLFKlEt5uUyf+e lKSnhezFOsLT5/tX4ZQu00qEYLktOP95jzLpVYdBfakOX9WdCx3Rc9nNr8yOOHi67Jcz Nmj+5TENIa0rtcO3yAv9O+XO9q1Ax+33XfGoogzBnfh2QBL4p5L/HogyoLlGLhJjBfLB 60vT7buAdSpYqI4amJ44MtYUHhzq9Zxqx3DH78kzerKFJo2pQiI9PAlt+jnj2w+XnuOI Urkg== X-Gm-Message-State: AIkVDXIGVtWak07/kG0W2E5yqTEGJzpWQZs4/chCz+cB0vMk68WeXXP1SHLqwk6t9zWKeIvI X-Received: by 10.28.109.218 with SMTP id b87mr15394433wmi.52.1484660751291; Tue, 17 Jan 2017 05:45:51 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l187sm37064811wml.6.2017.01.17.05.45.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 05:45:50 -0800 (PST) From: Alexandre Bailon To: vinod.koul@intel.com, b-liu@ti.com, robh+dt@kernel.org 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, devicetree@vger.kernel.org, Alexandre Bailon Subject: [PATCH v2 2/7] usb: usb: dsps: update device tree bindings Date: Tue, 17 Jan 2017 14:45:35 +0100 Message-Id: <20170117134540.9988-3-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117134540.9988-1-abailon@baylibre.com> References: <20170117134540.9988-1-abailon@baylibre.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In order to make CPPI 4.1 DMA driver more generic, accesses to USBSS have been removed. So it is not required anymore to define "glue" register's address and size in DT. Update dsps device tree bindings. Signed-off-by: Alexandre Bailon --- Documentation/devicetree/bindings/usb/am33xx-usb.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" 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/Documentation/devicetree/bindings/usb/am33xx-usb.txt b/Documentation/devicetree/bindings/usb/am33xx-usb.txt index 20c2ff2..ef89010 100644 --- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt +++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt @@ -54,9 +54,9 @@ node. DMA ~~~ - compatible: ti,am3359-cppi41 -- reg: offset and length of the following register spaces: USBSS, USB +- reg: offset and length of the following register spaces: USB CPPI DMA Controller, USB CPPI DMA Scheduler, USB Queue Manager -- reg-names: glue, controller, scheduler, queuemgr +- reg-names: controller, scheduler, queuemgr - #dma-cells: should be set to 2. The first number represents the endpoint number (0 … 14 for endpoints 1 … 15 on instance 0 and 15 … 29 for endpoints 1 … 15 on instance 1). The second number is 0 for RX and @@ -183,11 +183,10 @@ usb: usb@47400000 { cppi41dma: dma-controller@07402000 { compatible = "ti,am3359-cppi41"; - reg = <0x47400000 0x1000 - 0x47402000 0x1000 + reg = <0x47402000 0x1000 0x47403000 0x1000 0x47404000 0x4000>; - reg-names = "glue", "controller", "scheduler", "queuemgr"; + reg-names = "controller", "scheduler", "queuemgr"; interrupts = <17>; interrupt-names = "glue"; #dma-cells = <2>; From patchwork Tue Jan 17 13:45:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91655 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp498808qgi; Tue, 17 Jan 2017 05:53:13 -0800 (PST) X-Received: by 10.84.164.106 with SMTP id m39mr58363252plg.97.1484661193901; Tue, 17 Jan 2017 05:53:13 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si3430770pfb.281.2017.01.17.05.53.13; Tue, 17 Jan 2017 05:53:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751244AbdAQNxM (ORCPT + 7 others); Tue, 17 Jan 2017 08:53:12 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:38724 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751177AbdAQNxL (ORCPT ); Tue, 17 Jan 2017 08:53:11 -0500 Received: by mail-wm0-f54.google.com with SMTP id r144so223394005wme.1 for ; Tue, 17 Jan 2017 05:53:06 -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=i+t+duwNsAyA63YDWiQqSVB7zCevby5SsrMAlL1oMyI=; b=JWdK/eXw7qA8nbLeemAUhO2oL07KJiVLaaDC62/fz5GX3lWsDJROS4OzVnCeoZxaZG uflj+lZOHtziZ3S9g8xicBzAAjidnUdNsjhVH3E8U6pCe2Qkql7OnvB4OhXZ8+2ekfXX fLmjVDUpwA5kDDYXgM4h5fKVGc3OSpM/pDP1J3JluC6v2iKhokwi7xDUeYnBCTnrES+4 kH4Er/NPclVig6LlM6W14D2ALCqcneJcjchH4eDmUEc9UL/z6FbJy5Cw3w1a9Z9taeZl 8vcIowbsMb1DOtH8e1T3GyyPNBuimuzPXLypcfnQudd8lg1rqd3GkfHOqKyd1dQ4/BJM 8Rvw== 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=i+t+duwNsAyA63YDWiQqSVB7zCevby5SsrMAlL1oMyI=; b=hII669Tp90b3IybqhiVLOQ/fOjlXh2D/cmmAyhLosknBAk6Oc6V8bSb73uC8j8LiEs oqcSu9IR1qzRXCwQAjcit2iFVkXyduyNNceq7I0P2UfD93Lw/+X0g5xyHhMeFzl0uCAc vhLSZKUKE5ggN1AmQIaQXZksaEj5guztwI5exYiTLgpORbhNBdngk3FOHpzMMVRYteXn ub2NgSSsSO44nDk2neqN32kUu6vLuwtInw42xUswoI+kiO00XVwE9Yfid/g5dtDiCSvF 7X8jEn58AKkS9jEPxYmJCXYhDPAm8DmxR2X9QeXtbfWelHYIgvTabd5/C/QGyZ64PfmG Lprg== X-Gm-Message-State: AIkVDXLoEkk9m9zQArIWn2P1pvanKvhc3RWTtpi6LZjPqzNHufrsPzLZS8WYkDI1fA5p4TST X-Received: by 10.28.63.5 with SMTP id m5mr17032321wma.95.1484660752544; Tue, 17 Jan 2017 05:45:52 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l187sm37064811wml.6.2017.01.17.05.45.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 05:45:52 -0800 (PST) From: Alexandre Bailon To: vinod.koul@intel.com, b-liu@ti.com, robh+dt@kernel.org 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, devicetree@vger.kernel.org, Alexandre Bailon Subject: [PATCH v2 3/7] dmaengine: cppi41: Remove usbss_mem Date: Tue, 17 Jan 2017 14:45:36 +0100 Message-Id: <20170117134540.9988-4-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117134540.9988-1-abailon@baylibre.com> References: <20170117134540.9988-1-abailon@baylibre.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In order to make CPPI 4.1 DMA driver more generic, accesses to USBSS have been removed. So it is not required anymore to map the "glue" register's. Remove usbss_mem. Signed-off-by: Alexandre Bailon --- drivers/dma/cppi41.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" 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/dma/cppi41.c b/drivers/dma/cppi41.c index 4999e7d..ecccf7b 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -131,7 +131,6 @@ struct cppi41_dd { u32 first_td_desc; struct cppi41_channel *chan_busy[ALLOC_DECS_NUM]; - void __iomem *usbss_mem; void __iomem *ctrl_mem; void __iomem *sched_mem; void __iomem *qmgr_mem; @@ -999,16 +998,15 @@ static int cppi41_dma_probe(struct platform_device *pdev) INIT_LIST_HEAD(&cdd->ddev.channels); cpp41_dma_info.dma_cap = cdd->ddev.cap_mask; - cdd->usbss_mem = of_iomap(dev->of_node, 0); - cdd->ctrl_mem = of_iomap(dev->of_node, 1); - cdd->sched_mem = of_iomap(dev->of_node, 2); - cdd->qmgr_mem = of_iomap(dev->of_node, 3); + cdd->ctrl_mem = of_iomap(dev->of_node, 0); + cdd->sched_mem = of_iomap(dev->of_node, 1); + cdd->qmgr_mem = of_iomap(dev->of_node, 2); spin_lock_init(&cdd->lock); INIT_LIST_HEAD(&cdd->pending); platform_set_drvdata(pdev, cdd); - if (!cdd->usbss_mem || !cdd->ctrl_mem || !cdd->sched_mem || + if (!cdd->ctrl_mem || !cdd->sched_mem || !cdd->qmgr_mem) return -ENXIO; @@ -1068,7 +1066,6 @@ static int cppi41_dma_probe(struct platform_device *pdev) err_get_sync: pm_runtime_put_sync(dev); pm_runtime_disable(dev); - iounmap(cdd->usbss_mem); iounmap(cdd->ctrl_mem); iounmap(cdd->sched_mem); iounmap(cdd->qmgr_mem); @@ -1090,7 +1087,6 @@ static int cppi41_dma_remove(struct platform_device *pdev) devm_free_irq(&pdev->dev, cdd->irq, cdd); cleanup_chans(cdd); deinit_cppi41(&pdev->dev, cdd); - iounmap(cdd->usbss_mem); iounmap(cdd->ctrl_mem); iounmap(cdd->sched_mem); iounmap(cdd->qmgr_mem); From patchwork Tue Jan 17 13:45:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91656 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp499181qgi; Tue, 17 Jan 2017 05:54:07 -0800 (PST) X-Received: by 10.99.52.11 with SMTP id b11mr46130592pga.131.1484661247274; Tue, 17 Jan 2017 05:54:07 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i71si25024067pfa.238.2017.01.17.05.54.07; Tue, 17 Jan 2017 05:54:07 -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 S1751274AbdAQNyE (ORCPT + 4 others); Tue, 17 Jan 2017 08:54:04 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:34950 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751023AbdAQNyD (ORCPT ); Tue, 17 Jan 2017 08:54:03 -0500 Received: by mail-wm0-f52.google.com with SMTP id r126so201653716wmr.0 for ; Tue, 17 Jan 2017 05:54:02 -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=yTckkykYWR9l9vrA9ijZRalSBCzd9kFqI+jabePHdOk=; b=UIeeIntZ6xGgxlez8/HP30B9EjlMd8Noq+BrDFRU5/imw+BBFx+4s6SSDeOxTfkqgy Bh/F0/e+gNTiXlAhUw5166oynzDq39WEsJcljw1veaLRislxQxdI9fE7fPqjXWQWxR47 W9sTnql+1tWgOQA9mVng53xsOED7sRXUFekBDWImoLN5A8+N4e4h6VzGI+qnqm7qQHTy PZqqgB4j02mCpEp0IsWMa6Iq8G/ZjyXQnwLr5mnFY6ZUEZB9vXFgpw9tfmHJeBNMc9wy DKY9sbp3+uplPc7fPzbKislfnkHLQ6jOLJmth+MmyeyFrSdoxIlhQleei9bJ+mRRqhMI md8A== 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=yTckkykYWR9l9vrA9ijZRalSBCzd9kFqI+jabePHdOk=; b=iHUkUEgJUgSg/4Dzj41bfTRF8aO/oeyUAY9RxFbQp68GOQm6JK6e5bzW3slb8qL7+o wJMXNcdsJVNgKoZ9J7X8hIoElD/g2slNgXC2cq2L6jptgahU7VUhywCSbmto1/rqSLFv dRA67wl9pu1i3hxjIIIlFwbKEviSaiXY1esl4YIo+nToXw2KhvMe8t2J48zHcNfGYVfS umfWYhPvcWmW6n/mOo0YmFeA4Q2CANs0Ao+pLgMRtmkqZth5WRiliCXH4ifD/9KcWO9V 08yeUn8hfpSr98c3rEZsO+ZcdSmfXVlqz4zwHAaDihmJqrAKWTB5xoLxfzChB6/doSwL PmIg== X-Gm-Message-State: AIkVDXIF/3ewnq+ALrvQyQzefFG17PEL0o9/RyYXQKDcKpKJ4bm1DCoHmiGuENkUeZQYJa7w X-Received: by 10.28.84.88 with SMTP id p24mr15445547wmi.52.1484660754132; Tue, 17 Jan 2017 05:45:54 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l187sm37064811wml.6.2017.01.17.05.45.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 05:45:53 -0800 (PST) From: Alexandre Bailon To: vinod.koul@intel.com, b-liu@ti.com, robh+dt@kernel.org 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, devicetree@vger.kernel.org, Alexandre Bailon Subject: [PATCH v2 4/7] dmaengine: cppi41: rename platform variables Date: Tue, 17 Jan 2017 14:45:37 +0100 Message-Id: <20170117134540.9988-5-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117134540.9988-1-abailon@baylibre.com> References: <20170117134540.9988-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Currently, only the AM335x is supported by the driver. Though the driver has a glue layer to support different platforms, some platform variable names are not prefixed with the platform name. To facilitate the addition of a new platform, rename some variables owned by the AM335x glue. Signed-off-by: Alexandre Bailon --- drivers/dma/cppi41.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 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/dma/cppi41.c b/drivers/dma/cppi41.c index ecccf7b..5527376 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -147,7 +147,7 @@ struct cppi41_dd { }; #define FIST_COMPLETION_QUEUE 93 -static struct chan_queues usb_queues_tx[] = { +static struct chan_queues am335x_usb_queues_tx[] = { /* USB0 ENDP 1 */ [ 0] = { .submit = 32, .complete = 93}, [ 1] = { .submit = 34, .complete = 94}, @@ -183,7 +183,7 @@ static struct chan_queues usb_queues_tx[] = { [29] = { .submit = 90, .complete = 139}, }; -static const struct chan_queues usb_queues_rx[] = { +static const struct chan_queues am335x_usb_queues_rx[] = { /* USB0 ENDP 1 */ [ 0] = { .submit = 1, .complete = 109}, [ 1] = { .submit = 2, .complete = 110}, @@ -910,8 +910,9 @@ static bool cpp41_dma_filter_fn(struct dma_chan *chan, void *param) else queues = cdd->queues_rx; - BUILD_BUG_ON(ARRAY_SIZE(usb_queues_rx) != ARRAY_SIZE(usb_queues_tx)); - if (WARN_ON(cchan->port_num > ARRAY_SIZE(usb_queues_rx))) + BUILD_BUG_ON(ARRAY_SIZE(am335x_usb_queues_rx) != + ARRAY_SIZE(am335x_usb_queues_tx)); + if (WARN_ON(cchan->port_num > ARRAY_SIZE(am335x_usb_queues_rx))) return false; cchan->q_num = queues[cchan->port_num].submit; @@ -939,15 +940,15 @@ static struct dma_chan *cppi41_dma_xlate(struct of_phandle_args *dma_spec, &dma_spec->args[0]); } -static const struct cppi_glue_infos usb_infos = { +static const struct cppi_glue_infos am335x_usb_infos = { .isr = cppi41_irq, - .queues_rx = usb_queues_rx, - .queues_tx = usb_queues_tx, + .queues_rx = am335x_usb_queues_rx, + .queues_tx = am335x_usb_queues_tx, .td_queue = { .submit = 31, .complete = 0 }, }; static const struct of_device_id cppi41_dma_ids[] = { - { .compatible = "ti,am3359-cppi41", .data = &usb_infos}, + { .compatible = "ti,am3359-cppi41", .data = &am335x_usb_infos}, {}, }; MODULE_DEVICE_TABLE(of, cppi41_dma_ids); From patchwork Tue Jan 17 13:45:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91651 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp498729qgi; Tue, 17 Jan 2017 05:53:02 -0800 (PST) X-Received: by 10.99.123.68 with SMTP id k4mr46874822pgn.101.1484661182453; Tue, 17 Jan 2017 05:53:02 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si25008640plm.337.2017.01.17.05.53.02; Tue, 17 Jan 2017 05:53:02 -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 S1751146AbdAQNw7 (ORCPT + 4 others); Tue, 17 Jan 2017 08:52:59 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:33971 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751140AbdAQNwy (ORCPT ); Tue, 17 Jan 2017 08:52:54 -0500 Received: by mail-wm0-f44.google.com with SMTP id f73so39173953wmf.1 for ; Tue, 17 Jan 2017 05:52:30 -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=m/Zuy2awYirv7DhS3Dbk+BLPrGFMbzhM/VMkWVNZwuA=; b=tzsG+9Rb88to2mc4S/Pu406macOlChzk4qIEmvDzIKb9BzrbSrH/0hX6Z4ExcPmhju FIZ37GAnOJ1/vQCDmz8IhNQH18XLP0sC2N6YFZ7q0NTa0cN0ukCcBPcib2ip6veI0gB2 yfKO/oLaNz38JHnbq0NjtGSQ/cct+/W+PKIM8KgZMui2V0VKwPi74WEmZLrXlpWIELxG TQzVF91qwkS3BwTlvZ7BeyfrCw54jNH5jt8kR0uxoig1DkD+ytB5ST8fwg9qXpPh3MgH PxvILBISL7g63ZfIXODJJnAR9ubcz14sdbVHcC45B9BlvaP/QQ4k1ADgKLXoMgleQyfu BrqA== 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=m/Zuy2awYirv7DhS3Dbk+BLPrGFMbzhM/VMkWVNZwuA=; b=TZwQfkfgHbT9sk+7ygkIVnBnbPukYWc4ZSGXwujxFl7ILmn07KCMSGV6fOar3+ZWn4 iiCZ8uCKjTRGIJjfoOeIU9Zl//365CEKXGVC1vE3uep5w9w309DHUFQazS+HL361VV7c r1bVpA8dOJJBvIlvutMxVf3Q9/gHqSP6TfzsD4MWZAvE6TLhG5+vDKozyhW83jBQt8PH O4T6SyQxmZR18IHSaEpDsZWbRQR48wOQSBXU8P+gi4NBcjE9XhoonEaB0pKmb2bw+yhN l5qFXZhYEEruw4p0sk+CGsjXr5BGkoXm//bMCHC2I6dL+4sXaMCrao0PXP1nC0AD1m7B vk2A== X-Gm-Message-State: AIkVDXI02bL0U4myRrpfNKSc4/wZ5KqIb9Yz1P6bOclITGDrTTDsbKjcWFXFfdutv5TqY0pj X-Received: by 10.223.146.39 with SMTP id 36mr11840961wrj.85.1484660755554; Tue, 17 Jan 2017 05:45:55 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l187sm37064811wml.6.2017.01.17.05.45.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 05:45:55 -0800 (PST) From: Alexandre Bailon To: vinod.koul@intel.com, b-liu@ti.com, robh+dt@kernel.org 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, devicetree@vger.kernel.org, Alexandre Bailon Subject: [PATCH v2 5/7] dmaengine: cppi41: Move some constants to glue layer Date: Tue, 17 Jan 2017 14:45:38 +0100 Message-Id: <20170117134540.9988-6-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117134540.9988-1-abailon@baylibre.com> References: <20170117134540.9988-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Some constants are defined and use by the driver whereas they are specifics to AM335x. Add new variables to the glue layer, initialize them with the constants, and use them in the driver. Signed-off-by: Alexandre Bailon --- drivers/dma/cppi41.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 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/dma/cppi41.c b/drivers/dma/cppi41.c index 5527376..3b2f57f 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -68,7 +68,6 @@ #define QMGR_MEMCTRL_IDX_SH 16 #define QMGR_MEMCTRL_DESC_SH 8 -#define QMGR_NUM_PEND 5 #define QMGR_PEND(x) (0x90 + (x) * 4) #define QMGR_PENDING_SLOT_Q(x) (x / 32) @@ -138,6 +137,8 @@ struct cppi41_dd { const struct chan_queues *queues_rx; const struct chan_queues *queues_tx; struct chan_queues td_queue; + u16 first_completion_queue; + u16 qmgr_num_pend; struct list_head pending; /* Pending queued transfers */ spinlock_t lock; /* Lock for pending list */ @@ -146,7 +147,6 @@ struct cppi41_dd { unsigned int dma_tdfdq; }; -#define FIST_COMPLETION_QUEUE 93 static struct chan_queues am335x_usb_queues_tx[] = { /* USB0 ENDP 1 */ [ 0] = { .submit = 32, .complete = 93}, @@ -224,6 +224,8 @@ struct cppi_glue_infos { const struct chan_queues *queues_rx; const struct chan_queues *queues_tx; struct chan_queues td_queue; + u16 first_completion_queue; + u16 qmgr_num_pend; }; static struct cppi41_channel *to_cpp41_chan(struct dma_chan *c) @@ -278,19 +280,21 @@ static u32 cppi41_pop_desc(struct cppi41_dd *cdd, unsigned queue_num) static irqreturn_t cppi41_irq(int irq, void *data) { struct cppi41_dd *cdd = data; + u16 first_completion_queue = cdd->first_completion_queue; + u16 qmgr_num_pend = cdd->qmgr_num_pend; struct cppi41_channel *c; int i; - for (i = QMGR_PENDING_SLOT_Q(FIST_COMPLETION_QUEUE); i < QMGR_NUM_PEND; + for (i = QMGR_PENDING_SLOT_Q(first_completion_queue); i < qmgr_num_pend; i++) { u32 val; u32 q_num; val = cppi_readl(cdd->qmgr_mem + QMGR_PEND(i)); - if (i == QMGR_PENDING_SLOT_Q(FIST_COMPLETION_QUEUE) && val) { + if (i == QMGR_PENDING_SLOT_Q(first_completion_queue) && val) { u32 mask; /* set corresponding bit for completetion Q 93 */ - mask = 1 << QMGR_PENDING_BIT_Q(FIST_COMPLETION_QUEUE); + mask = 1 << QMGR_PENDING_BIT_Q(first_completion_queue); /* not set all bits for queues less than Q 93 */ mask--; /* now invert and keep only Q 93+ set */ @@ -862,7 +866,7 @@ static int init_cppi41(struct device *dev, struct cppi41_dd *cdd) return -ENOMEM; cppi_writel(cdd->scratch_phys, cdd->qmgr_mem + QMGR_LRAM0_BASE); - cppi_writel(QMGR_SCRATCH_SIZE, cdd->qmgr_mem + QMGR_LRAM_SIZE); + cppi_writel(TOTAL_DESCS_NUM, cdd->qmgr_mem + QMGR_LRAM_SIZE); cppi_writel(0, cdd->qmgr_mem + QMGR_LRAM1_BASE); ret = init_descs(dev, cdd); @@ -945,6 +949,8 @@ static const struct cppi_glue_infos am335x_usb_infos = { .queues_rx = am335x_usb_queues_rx, .queues_tx = am335x_usb_queues_tx, .td_queue = { .submit = 31, .complete = 0 }, + .first_completion_queue = 93, + .qmgr_num_pend = 5, }; static const struct of_device_id cppi41_dma_ids[] = { @@ -1021,6 +1027,8 @@ static int cppi41_dma_probe(struct platform_device *pdev) cdd->queues_rx = glue_info->queues_rx; cdd->queues_tx = glue_info->queues_tx; cdd->td_queue = glue_info->td_queue; + cdd->qmgr_num_pend = glue_info->qmgr_num_pend; + cdd->first_completion_queue = glue_info->first_completion_queue; ret = init_cppi41(dev, cdd); if (ret) From patchwork Tue Jan 17 13:45:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91653 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp498752qgi; Tue, 17 Jan 2017 05:53:05 -0800 (PST) X-Received: by 10.99.222.17 with SMTP id f17mr12534417pgg.127.1484661185650; Tue, 17 Jan 2017 05:53:05 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7si3430770pfb.281.2017.01.17.05.53.05; Tue, 17 Jan 2017 05:53:05 -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 S1751158AbdAQNxB (ORCPT + 4 others); Tue, 17 Jan 2017 08:53:01 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38495 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751177AbdAQNwy (ORCPT ); Tue, 17 Jan 2017 08:52:54 -0500 Received: by mail-wm0-f51.google.com with SMTP id r144so223383500wme.1 for ; Tue, 17 Jan 2017 05:52:51 -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=yn2569mM1Ru1tXAw1Bq1zzG+MK0NtIhB4kAFM+YAAHI=; b=k0WS2K7Xl1kRz+sfRblqnMF0YKidDn5NjhlUII+y74jfLIIH8EcMCpPIT9VyMsEap/ s+hHRMWcruxYhLPQ59v4r+Mktf2+0LIwnkeqsrnID2KbjxjE1wJYLce7HEooh62L2HMh LcH1QiABN/iW2pWNdccg8Bf+09Gpea9IiOD7BQDZ9vH8drcCMXxUmRh5sw9/mJKAALyY yivc93VrwA2Q9FY7tYZVwVUwLdz1QQPJG3v7DJHGoOpBr/dRdTgTk4VT78Ner4MMII31 g6Nh9/+h6NyzD63TJ3MFMnysPwz0z2EWC+9ryjlpI5DSRYpPc1CxPLDfdyd7LrhfvVTI 8Azg== 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=yn2569mM1Ru1tXAw1Bq1zzG+MK0NtIhB4kAFM+YAAHI=; b=OPS2B4UqDJEuQhhHrWmC57+UtxV8VpYTQXHCrbyUlZSp49WxsHY2/MUKk6ClhVJnvA m7u66fJ3lsZYM++ja1oFpDlERw8O6c04ZVwMFcKkoyUxnj3MYtYInIDsHurrPLGYEcTZ 6lvE6/0hi5y7FlGwBNNBb+To0Olu4ZbK2f9+qEGY9jmpm+bdOQCC7qkeRHJEnAoUhXzn 7jZhacW2vB85xmjtLbeG8fE1NHoGbqEK0EFlSApaYvPml6tfw0ZHy5W3LTtty1SJlKzT ZKobsu1pQ0H1t/5g3Qyf3RXyIebm/n6jWI3YwbLevZDJ0TM6AliTFUBDlW/DebW7Ietc Y9LQ== X-Gm-Message-State: AIkVDXJYVo14zgTFltcc7vCATOpu4B6072MbSYeJ9bikrZQ84RfxVk47m+K+mcyjN/GoaWK1 X-Received: by 10.28.216.14 with SMTP id p14mr15354850wmg.56.1484660756470; Tue, 17 Jan 2017 05:45:56 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l187sm37064811wml.6.2017.01.17.05.45.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 05:45:56 -0800 (PST) From: Alexandre Bailon To: vinod.koul@intel.com, b-liu@ti.com, robh+dt@kernel.org 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, devicetree@vger.kernel.org, Alexandre Bailon Subject: [PATCH v2 6/7] dmaengine: cppi41: init_sched(): Get number of channels from DT Date: Tue, 17 Jan 2017 14:45:39 +0100 Message-Id: <20170117134540.9988-7-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117134540.9988-1-abailon@baylibre.com> References: <20170117134540.9988-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Despite the driver is already using DT to get the number of channels, init_sched() is using an hardcoded value to get it. Use DT to get the number of channels. Signed-off-by: Alexandre Bailon --- drivers/dma/cppi41.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 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/dma/cppi41.c b/drivers/dma/cppi41.c index 3b2f57f..303ccee 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -139,6 +139,8 @@ struct cppi41_dd { struct chan_queues td_queue; u16 first_completion_queue; u16 qmgr_num_pend; + u32 n_chans; + u8 platform; struct list_head pending; /* Pending queued transfers */ spinlock_t lock; /* Lock for pending list */ @@ -720,13 +722,8 @@ static int cppi41_add_chans(struct device *dev, struct cppi41_dd *cdd) { struct cppi41_channel *cchan; int i; - int ret; - u32 n_chans; + u32 n_chans = cdd->n_chans; - ret = of_property_read_u32(dev->of_node, "#dma-channels", - &n_chans); - if (ret) - return ret; /* * The channels can only be used as TX or as RX. So we add twice * that much dma channels because USB can only do RX or TX. @@ -832,7 +829,7 @@ static int init_descs(struct device *dev, struct cppi41_dd *cdd) return 0; } -static void init_sched(struct cppi41_dd *cdd) +static int init_sched(struct device *dev, struct cppi41_dd *cdd) { unsigned ch; unsigned word; @@ -840,7 +837,7 @@ static void init_sched(struct cppi41_dd *cdd) word = 0; cppi_writel(0, cdd->sched_mem + DMA_SCHED_CTRL); - for (ch = 0; ch < 15 * 2; ch += 2) { + for (ch = 0; ch < cdd->n_chans; ch += 2) { reg = SCHED_ENTRY0_CHAN(ch); reg |= SCHED_ENTRY1_CHAN(ch) | SCHED_ENTRY1_IS_RX; @@ -850,9 +847,11 @@ static void init_sched(struct cppi41_dd *cdd) cppi_writel(reg, cdd->sched_mem + DMA_SCHED_WORD(word)); word++; } - reg = 15 * 2 * 2 - 1; + reg = cdd->n_chans * 2 - 1; reg |= DMA_SCHED_CTRL_EN; cppi_writel(reg, cdd->sched_mem + DMA_SCHED_CTRL); + + return 0; } static int init_cppi41(struct device *dev, struct cppi41_dd *cdd) @@ -871,12 +870,14 @@ static int init_cppi41(struct device *dev, struct cppi41_dd *cdd) ret = init_descs(dev, cdd); if (ret) - goto err_td; + goto deinit; cppi_writel(cdd->td_queue.submit, cdd->ctrl_mem + DMA_TDFDQ); - init_sched(cdd); + ret = init_sched(dev, cdd); + if (ret) + goto deinit; return 0; -err_td: +deinit: deinit_cppi41(dev, cdd); return ret; } @@ -1030,6 +1031,11 @@ static int cppi41_dma_probe(struct platform_device *pdev) cdd->qmgr_num_pend = glue_info->qmgr_num_pend; cdd->first_completion_queue = glue_info->first_completion_queue; + ret = of_property_read_u32(dev->of_node, + "#dma-channels", &cdd->n_chans); + if (ret) + goto err_get_n_chans; + ret = init_cppi41(dev, cdd); if (ret) goto err_init_cppi; @@ -1072,6 +1078,7 @@ static int cppi41_dma_probe(struct platform_device *pdev) deinit_cppi41(dev, cdd); err_init_cppi: pm_runtime_dont_use_autosuspend(dev); +err_get_n_chans: err_get_sync: pm_runtime_put_sync(dev); pm_runtime_disable(dev); @@ -1128,7 +1135,7 @@ static int __maybe_unused cppi41_resume(struct device *dev) if (!c->is_tx) cppi_writel(c->q_num, c->gcr_reg + RXHPCRA0); - init_sched(cdd); + init_sched(dev, cdd); cppi_writel(cdd->dma_tdfdq, cdd->ctrl_mem + DMA_TDFDQ); cppi_writel(cdd->scratch_phys, cdd->qmgr_mem + QMGR_LRAM0_BASE); From patchwork Tue Jan 17 13:45:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91652 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp498731qgi; Tue, 17 Jan 2017 05:53:02 -0800 (PST) X-Received: by 10.98.55.131 with SMTP id e125mr43704444pfa.58.1484661182869; Tue, 17 Jan 2017 05:53:02 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si25008640plm.337.2017.01.17.05.53.02; Tue, 17 Jan 2017 05:53:02 -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 S1751140AbdAQNxA (ORCPT + 4 others); Tue, 17 Jan 2017 08:53:00 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:38328 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751158AbdAQNwy (ORCPT ); Tue, 17 Jan 2017 08:52:54 -0500 Received: by mail-wm0-f53.google.com with SMTP id r144so223375769wme.1 for ; Tue, 17 Jan 2017 05:52:40 -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=7fpgNcJJF18Kt6HTI8Dobj2zVZWFCpKfcQZW2WXdZ28=; b=NW9R8tqoUZeE0s3BbO79EoPB8CAsjWykxvADOdnBXLaVxafl3Ht/wBmse+njGJLUse RDfW8Bi3HfaLVX9VxNBF3t3TyT6iCp2TANmSFzGoX5gJCTS1ZTZj5lD0dE24y76lMC/d hm81U7Gii0UBuauV020nMBUCGEiAhDPSWrp9jLzMioSR81yKTL13rb6ze+bgl5gTLnsk Crql9eDt57yLoPxYr+5+6hcbpRY3A+vXebVfJR1v+NZzveKJtCC6ZHl7/vsyEpKSauIu m+yqIXrQD7YzFwEKOqMelQVRqJMcffkQkzC2yVaxZJVTAQd2eMcGwxSrgWyzbahlftGm BfLA== 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=7fpgNcJJF18Kt6HTI8Dobj2zVZWFCpKfcQZW2WXdZ28=; b=hxfjljqJ+dO60ezdUv2KwNB49jM8oPWbpceBHLg9KEf47n/Fj4Ti1NDxeeuJnPbjEv qdhMKD5HJnBzUktuKAiAl9kZo0bVRlaBSzeQns+/Z2oAdhLWp+2vcw/8F0chYT8X1wRt UZ9Q3QqalgjXvuP5Oo+62BTDFr8heWFn6jT+30bJroFQx5eizJe5KyCyjq68HQVeg0z1 LV3sK8LqW1fY551OOWeeV1rM07K5i5sLzSZerJXFE17eEGGT2ErE/7ZYVjBJ6MGFuV9/ B8UVdMqf7D5KYTlua1L4avmiMz5DICadSGTqaQXSVtm+M5eFkqJkTtqPmLT2UrEPg3ct GWTA== X-Gm-Message-State: AIkVDXLyu71cW5a+2elcoJQAx++BUZ+VZdstrsRKikLQHRs/5gRPyJoGcmZV38RBU/ZwZ6I/ X-Received: by 10.28.203.75 with SMTP id b72mr18055115wmg.110.1484660757604; Tue, 17 Jan 2017 05:45:57 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l187sm37064811wml.6.2017.01.17.05.45.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 05:45:57 -0800 (PST) From: Alexandre Bailon To: vinod.koul@intel.com, b-liu@ti.com, robh+dt@kernel.org 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, devicetree@vger.kernel.org, Alexandre Bailon Subject: [PATCH v2 7/7] dmaengine: cppi41: Fix a race between PM runtime and channel abort Date: Tue, 17 Jan 2017 14:45:40 +0100 Message-Id: <20170117134540.9988-8-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117134540.9988-1-abailon@baylibre.com> References: <20170117134540.9988-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org cppi41_dma_issue_pending() may be called while the device is runtime suspended. In that case, the descriptor will be pushed to the pending list and then be queued to hardware queue. But if cppi41_stop_chan() is called before the device got time to resume, then the descriptor will remain in the pending list and be queued to hardware queue after the teardown. During the channel stop, check if there is a pending descriptor and if so, remove it. Signed-off-by: Alexandre Bailon --- drivers/dma/cppi41.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 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/dma/cppi41.c b/drivers/dma/cppi41.c index 303ccee..0bc4f1a 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -687,10 +687,17 @@ static int cppi41_stop_chan(struct dma_chan *chan) { struct cppi41_channel *c = to_cpp41_chan(chan); struct cppi41_dd *cdd = c->cdd; + unsigned long flags; u32 desc_num; u32 desc_phys; int ret; + /* Remove pending descriptor that haven't been pushed to queue */ + spin_lock_irqsave(&cdd->lock, flags); + if (!list_empty(&c->node)) + list_del_init(&c->node); + spin_unlock_irqrestore(&cdd->lock, flags); + desc_phys = lower_32_bits(c->desc_phys); desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc); if (!cdd->chan_busy[desc_num]) @@ -748,6 +755,7 @@ static int cppi41_add_chans(struct device *dev, struct cppi41_dd *cdd) cchan->desc_phys = cdd->descs_phys; cchan->desc_phys += i * sizeof(struct cppi41_desc); cchan->chan.device = &cdd->ddev; + INIT_LIST_HEAD(&cchan->node); list_add_tail(&cchan->chan.device_node, &cdd->ddev.channels); } cdd->first_td_desc = n_chans; @@ -1163,7 +1171,7 @@ static int __maybe_unused cppi41_runtime_resume(struct device *dev) spin_lock_irqsave(&cdd->lock, flags); list_for_each_entry_safe(c, _c, &cdd->pending, node) { push_desc_queue(c); - list_del(&c->node); + list_del_init(&c->node); } spin_unlock_irqrestore(&cdd->lock, flags);