From patchwork Mon Jan 23 17:24:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92258 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1328703qgi; Mon, 23 Jan 2017 09:25:12 -0800 (PST) X-Received: by 10.84.197.1 with SMTP id m1mr45433903pld.123.1485192312448; Mon, 23 Jan 2017 09:25:12 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si16248948plj.268.2017.01.23.09.25.12; Mon, 23 Jan 2017 09:25:12 -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 S1751398AbdAWRZK (ORCPT + 4 others); Mon, 23 Jan 2017 12:25:10 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:38444 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751289AbdAWRZI (ORCPT ); Mon, 23 Jan 2017 12:25:08 -0500 Received: by mail-wm0-f53.google.com with SMTP id r144so166710744wme.1 for ; Mon, 23 Jan 2017 09:25:03 -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=ezswBeuWKFLNlmYYPSTuH4xMtF7vXTE/bzo6OLkZvhw=; b=oHMg7wTukpR0X33A35j97ygpk5xcoWdYWiQhqqQTPKrMCW14Q0aUnpF6jjwlU7k2rE 1li4j9hVmG+woGkmv9FMu5RMGQ6enDw/MTSKdh4tgkBKOVDbP73ZVDVgBPTbFe7VV++U biROYFG5Mf65u49GQx1wJeePaxuhFAKO5Bm7ZumNUPN55NXE8wno8t5RC2s4pRjc2J4l zMASFq3NSaWQMpbEoCPfXZZ6aA+SCGY0IH6nmq96t71cR0ESQDffBvsYLINIXyeGZVAD sV1CgPzrmfQkV04lbHc63bW2/fMHIRsAVUmSt25MHWmllSy8GUwAp1f8u6am011Zdzpo xmKg== 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=ezswBeuWKFLNlmYYPSTuH4xMtF7vXTE/bzo6OLkZvhw=; b=ejMQwZlTQzz8h3Ip5ee3W38tlEfnwt7eed8MFNETijc86aeJjUDVhoxO0C7Lds60MM IUjSJoIfAt4KgdcDtoU8VTUlJN0sDCMIPo03fsGTp7Q9G3ZmVmldN/qWmQrAf3rZuSSt hIz9sisHgTThBvL5B4YJ+7O3NZUkoSYdcrcIqsLnOB3VaxLZv8kgUfD9XtfM9NJWZMQ/ 07vfXYQvR2ibdvv4rGU1vk19tb/ZRg8urhaZPSEzO2Mb1OQX58M19S4LvNQ0p+XokWBA ummVszxbS5dGXqBRBZC7LChTV4snJbGdo+EzCnv7F6oiEGIgyxbT6DTl8xMHhpE8haN2 s90g== X-Gm-Message-State: AIkVDXJ8+Z1CQosOj/OtNMVdv11JbZXR0Il/Xt6ZfpPMR8UqIyuWcI0MWt2LWvwWRYcYDtR6 X-Received: by 10.28.94.8 with SMTP id s8mr14021925wmb.117.1485192302298; Mon, 23 Jan 2017 09:25:02 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id g71sm11328119wmc.9.2017.01.23.09.25.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jan 2017 09:25:01 -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 v4 1/5] dmaengine: cppi41: Remove usbss_mem Date: Mon, 23 Jan 2017 18:24:48 +0100 Message-Id: <20170123172453.30224-2-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170123172453.30224-1-abailon@baylibre.com> References: <20170123172453.30224-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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 | 18 ++++++++++-------- 1 file changed, 10 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 4999e7d..1743d3d 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; @@ -973,6 +972,7 @@ static int cppi41_dma_probe(struct platform_device *pdev) struct cppi41_dd *cdd; struct device *dev = &pdev->dev; const struct cppi_glue_infos *glue_info; + int index; int irq; int ret; @@ -999,16 +999,20 @@ 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); + index = of_property_match_string(dev->of_node, + "reg-names", "controller"); + if (index < 0) + return index; + + cdd->ctrl_mem = of_iomap(dev->of_node, index); + cdd->sched_mem = of_iomap(dev->of_node, index + 1); + cdd->qmgr_mem = of_iomap(dev->of_node, index + 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 +1072,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 +1093,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 Mon Jan 23 17:24:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92255 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1328695qgi; Mon, 23 Jan 2017 09:25:11 -0800 (PST) X-Received: by 10.98.35.25 with SMTP id j25mr33051786pfj.35.1485192311147; Mon, 23 Jan 2017 09:25:11 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si16248948plj.268.2017.01.23.09.25.11; Mon, 23 Jan 2017 09:25:11 -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 S1751238AbdAWRZF (ORCPT + 4 others); Mon, 23 Jan 2017 12:25:05 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:33734 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751152AbdAWRZE (ORCPT ); Mon, 23 Jan 2017 12:25:04 -0500 Received: by mail-wm0-f50.google.com with SMTP id d140so35651797wmd.0 for ; Mon, 23 Jan 2017 09:25:04 -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=O/DGMdK/5Y8PzIuJevIDeYXKGGJbB4t7bTHHMcahuqc=; b=anzB1hAqT9LUWYlidw8rc67to2IBDKUUKMGfZXGrco0Awn9aEL4KKYAizuq2ldBAlA 7HSdO/vN9dkgrNbYLJ60tCZkOGv9gcPbSX3qwybLzC6eTtpkTYRP/1/Pm+9Stj91HQH3 wW+6JNRW58/9xKfYFPjaPF3eQXfgAacC8a0kS+xzgKfNv3m1gU+6yZo2UuEkxWsxEBa2 axgyQcEACirzkY4dwiwm2M6/L9DPTX9dv7CfLis+8s4jJAwKucLpY7XuRXwWV7Gz1w/S wLiMSsafBBLv52ov6ulv96EZHhkXPFjyoJ+SLsLV388CUmbRDDuSmXnelOb3pfsrYe9D Jhsw== 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=O/DGMdK/5Y8PzIuJevIDeYXKGGJbB4t7bTHHMcahuqc=; b=bwrBJPEWGFyqFHzSjstP0KopO7xIEAfMSWeyGIMeQbLMQSsZB1U/1lKqgdabExrsu+ uCN3sVZHjW3tfxaI26gJO5VWcRXeHevFfWVT7dJnKUtF9+5sW94rcaJOCV/zpPJgYwlT bSrfx7k3C1/O5GND0AYwJo1wlodxrd05cThMlrSm6oOxwjPRcL7LumUmy4CGraDr3gvl y0f8vqNe31e2Rrs+K1LstlAgWv5xJNiDACLiFfVPzBoGKeWqlRO7bYlrTemokf3+qcZr kLRooIjjlOHu/7GfSc+85YO9aDXMujABCw5nJjKBQTLjgp0AvM6rIdrAwT0b7O70HWQp l5Sg== X-Gm-Message-State: AIkVDXIfBn+VUYeDAPY4/LXN6LMzfawjtBtgIhU9Qru7fKDy2wxKizkSHn0g8wBB9/gvy1fS X-Received: by 10.223.164.151 with SMTP id g23mr25126815wrb.86.1485192303156; Mon, 23 Jan 2017 09:25:03 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id g71sm11328119wmc.9.2017.01.23.09.25.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jan 2017 09:25:02 -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 v4 2/5] dmaengine: cppi41: rename platform variables Date: Mon, 23 Jan 2017 18:24:49 +0100 Message-Id: <20170123172453.30224-3-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170123172453.30224-1-abailon@baylibre.com> References: <20170123172453.30224-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 1743d3d..a6addc3 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 Mon Jan 23 17:24:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92259 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1328712qgi; Mon, 23 Jan 2017 09:25:14 -0800 (PST) X-Received: by 10.84.178.7 with SMTP id y7mr44326722plb.60.1485192314163; Mon, 23 Jan 2017 09:25:14 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si16248948plj.268.2017.01.23.09.25.14; Mon, 23 Jan 2017 09:25:14 -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 S1751136AbdAWRZM (ORCPT + 4 others); Mon, 23 Jan 2017 12:25:12 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:35985 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751397AbdAWRZK (ORCPT ); Mon, 23 Jan 2017 12:25:10 -0500 Received: by mail-wm0-f51.google.com with SMTP id c85so143293960wmi.1 for ; Mon, 23 Jan 2017 09:25:04 -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=zqlx2L9FqIkb80KY+NzpHNmM4rVVILFSS4Q0xwecWWM=; b=UdTGMdFxJink4qvEmquvIFEEX3talmrIyowJ+14XGQ86fmwmx3tjU1/k/KK/GXjkIJ by6Ez93mCXW+EmrptquPJoebnGCKn35i/pTWW9VD3kpz0J9Jk/8E9M2ws37X3u9VFzx6 7lX5RWmJfuVhV2PuhqngmCLkRA1bol6z+QW8v7BNGXWQMMQFQ0I1BM2ZYhRMRBYof/HX zjMDJv3tuBi8dA0ZhpXJKMHFGYsedgqUnefHN7scATB5PcAwMoDU/Qnprcm9AFoMDNez yp+Uuc4MVQ6sLxD8Tft553NVNuYT1bJ5i0vQKY6HkFV5dQ2lvWXjk80/KmoN7kQR2I+T Uy+g== 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=zqlx2L9FqIkb80KY+NzpHNmM4rVVILFSS4Q0xwecWWM=; b=mx56l77P7Z4Ma3POFP75f1PW7Rbi/AlVtgje41gICbbWLyQEqInnNUzHOHU+rw67rD FUYtgyIouabustpFPvGE6nUI9ZjUbig4UuQa11P0PoD2trHGvVg4HcuIXOF1VeuDr82i 3vMETF7UU56i0kJ23pWYgvLu9yOAbdTeakFki6G7emPMp1Z/1R7dsIvfZcfvdDcBURqp UaouIQEpizvN7PlLDhjaG3lCMaHgSrQfwsBRxsqhdUkuKHCM5qwf0Um9JH06ZS9r3zAQ OOqESigVjUFHj5QmARomMpqkDbxybEEUC2U4cSTFikbTJpVEdqCkrkIBmT5W8hfMyTSD VUgw== X-Gm-Message-State: AIkVDXKCDllfKCIiMk8OxUi7FIRH++qi9+hWqZwnaET868kWToOFw+alYBJRYniG0lLSK5QR X-Received: by 10.28.134.67 with SMTP id i64mr14005019wmd.5.1485192304030; Mon, 23 Jan 2017 09:25:04 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id g71sm11328119wmc.9.2017.01.23.09.25.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jan 2017 09:25:03 -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 v4 3/5] dmaengine: cppi41: Move some constants to glue layer Date: Mon, 23 Jan 2017 18:24:50 +0100 Message-Id: <20170123172453.30224-4-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170123172453.30224-1-abailon@baylibre.com> References: <20170123172453.30224-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 a6addc3..5a40653 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[] = { @@ -1027,6 +1033,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 Mon Jan 23 17:24:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92256 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1328698qgi; Mon, 23 Jan 2017 09:25:11 -0800 (PST) X-Received: by 10.84.196.164 with SMTP id l33mr41595717pld.158.1485192311525; Mon, 23 Jan 2017 09:25:11 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si16248948plj.268.2017.01.23.09.25.11; Mon, 23 Jan 2017 09:25:11 -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 S1750981AbdAWRZH (ORCPT + 4 others); Mon, 23 Jan 2017 12:25:07 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:37677 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751289AbdAWRZG (ORCPT ); Mon, 23 Jan 2017 12:25:06 -0500 Received: by mail-wm0-f41.google.com with SMTP id c206so167020628wme.0 for ; Mon, 23 Jan 2017 09:25:05 -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=IKWpQtpyzwNjTCAUbHxdb2LHN9gcWGP4u7aRPIa2Rz8=; b=OySeA8UdCqxUnJ25bHppUR8E4LwhAARMDbIuUmARQ7nbE+pUtfiMNRJ1sYxsWpiEeL 4ttOzmB1dDr1nKD/qWAWxlpUhsYRnt0MHxxXzHc1hYDjvc/mvICziXqfqTGGBTpymUA8 IlPXgIZJWuwaFgIzLSllanum2S9zOBnAR6f+qrTW+JhNSMRiGdZnE12FjPbnioLkbePy gBctG5hzZLkOrXE46jYNYS96di39bX9JuUCXasOp8s6kArC0ynHF18OBMeRS3TShhw4g +5E1ILUQO/TvbFAIb1bySarTPDueXNDYTT8uF/PIuBKe9TLhsMTJIeg1B+a2qijaCjwK zYaw== 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=IKWpQtpyzwNjTCAUbHxdb2LHN9gcWGP4u7aRPIa2Rz8=; b=N9+lDSKcDzg5SeAJuhTKBcMb0CNtO4a95YTzgeaGt9+2b+rxvgDeulA+kDLFiTe24s m52nYdBYSAN2BVaFIDkt05wiP4spdjqaJM4HE4pxjhqHfWhV35WqDkiJsEFJvK22NN4F PWKQUUKKOepYyf2uNQJTu3SQukZUaHZb0N3xYHAPcGBqMvFVheMLYJlAEKPIGH8wAdA/ Id2Q+2XTHMjMYFNrjYFnOzxc8AsXqXpgH2yvUJGPnR+evId75WXVwo/Pw9KuhE/DvVs+ n6ccnLqTQZYEnQ4ECoypePdKT/yDTjhLvpNr2ioNkhJHIneSTfyxeBXZCh0Y5T/RQu6o 9dMA== X-Gm-Message-State: AIkVDXLgqx8Q2wQUbIrsfAkKRIxJfECoz+mr9/4OUn8Zgg6z+QTkfFvd3Ryjsn1AB50PB4kK X-Received: by 10.28.217.136 with SMTP id q130mr13242261wmg.13.1485192304847; Mon, 23 Jan 2017 09:25:04 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id g71sm11328119wmc.9.2017.01.23.09.25.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jan 2017 09:25:04 -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 v4 4/5] dmaengine: cppi41: init_sched(): Get number of channels from DT Date: Mon, 23 Jan 2017 18:24:51 +0100 Message-Id: <20170123172453.30224-5-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170123172453.30224-1-abailon@baylibre.com> References: <20170123172453.30224-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 | 20 ++++++++++++-------- 1 file changed, 12 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 5a40653..288205e 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. @@ -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,7 +847,7 @@ 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); } @@ -875,6 +872,7 @@ static int init_cppi41(struct device *dev, struct cppi41_dd *cdd) cppi_writel(cdd->td_queue.submit, cdd->ctrl_mem + DMA_TDFDQ); init_sched(cdd); + return 0; err_td: deinit_cppi41(dev, cdd); @@ -1036,6 +1034,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; @@ -1078,6 +1081,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); From patchwork Mon Jan 23 17:24:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92257 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1328702qgi; Mon, 23 Jan 2017 09:25:12 -0800 (PST) X-Received: by 10.98.198.90 with SMTP id m87mr32845635pfg.153.1485192312270; Mon, 23 Jan 2017 09:25:12 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si16248948plj.268.2017.01.23.09.25.12; Mon, 23 Jan 2017 09:25:12 -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 S1751289AbdAWRZK (ORCPT + 4 others); Mon, 23 Jan 2017 12:25:10 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:37723 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751194AbdAWRZI (ORCPT ); Mon, 23 Jan 2017 12:25:08 -0500 Received: by mail-wm0-f41.google.com with SMTP id c206so167022761wme.0 for ; Mon, 23 Jan 2017 09:25:08 -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=Zjgl5Rf01BobTeCo8jemcHT7wkN6FXxqkar6dN5pwEI=; b=dTMoLualUjqqPYOlJEFPJyBYYhVgi6j79uCTws7ObyzFP8bSMqecV9EB9KQitOKQLN LwWTNLuF7gE1nCnuA3XQv7gvk6QeYFzg7sN0gGIAb6iZjMZJb03kFC1QVk0iBkBuyP3b VfFmYg7GbPsml3oh5cut1mirpzDbVI+YYqKoDA7oUd3Zd3gAWJYHODWjBL9pm6UdB109 7W+aVY0GqviiBRk0IrdBRPjW+By4hFJOIOrjTS/jsbWe/TvoR71ipro8XVyfm1dw4fq9 vRZRMG4H28XjW7sp1sNxGGU4kDPiO2CJdFrBoA0neuQkZe1BkggtcbTrxVhu3adZvnZh FoAw== 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=Zjgl5Rf01BobTeCo8jemcHT7wkN6FXxqkar6dN5pwEI=; b=Zx9U1jp3zfG5o9WorMb7Z23nuigeVy7VNi3ayxzhE8sdPskkeeuYNKj1MaD8lArvXW aAK5pSxZYwJOZfPrQTtsfCXGQxXJYIR495a4UXJY2DEVFmsunNJHBx/cIZ7E74Md2b6R VNHUQeGMghklIcuQ6XcckHgLi8y6sic/1DsXi/3ClobpIDjiey5onWBocCOAoX9ZVIPY FKX7iFrWi68MNhFOHjFj5K8x+80uApSk6K1MWCKOGq2JpB9iir8OkJ11r0IW7GW2JaAp eEeiJ0jGg/wYkQ1CcXACPmlAPImLvGquQ32Y63DwtEC7Fsbe00646HILXd0IwN+O79d2 Ngcw== X-Gm-Message-State: AIkVDXIr3/HQKAbpZtk1PgTBB7MpyLOlHf+RT0W7pmDW5Q7sd6RWemxy4Fo/4wXKMgwkNQZu X-Received: by 10.223.136.85 with SMTP id e21mr24255337wre.28.1485192307342; Mon, 23 Jan 2017 09:25:07 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id g71sm11328119wmc.9.2017.01.23.09.25.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jan 2017 09:25:06 -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 v4 5/5] dmaengine: cppi41: Remove isr callbacks from glue layer Date: Mon, 23 Jan 2017 18:24:53 +0100 Message-Id: <20170123172453.30224-7-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170123172453.30224-1-abailon@baylibre.com> References: <20170123172453.30224-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org All the platform code to manage IRQ has been moved to MUSB, and now the interrupt handler is completely generic. Remove the isr callback that is not useful anymore. Signed-off-by: Alexandre Bailon --- drivers/dma/cppi41.c | 4 +--- 1 file changed, 1 insertion(+), 3 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 288205e..21a4f79 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -222,7 +222,6 @@ static const struct chan_queues am335x_usb_queues_rx[] = { }; struct cppi_glue_infos { - irqreturn_t (*isr)(int irq, void *data); const struct chan_queues *queues_rx; const struct chan_queues *queues_tx; struct chan_queues td_queue; @@ -943,7 +942,6 @@ static struct dma_chan *cppi41_dma_xlate(struct of_phandle_args *dma_spec, } static const struct cppi_glue_infos am335x_usb_infos = { - .isr = cppi41_irq, .queues_rx = am335x_usb_queues_rx, .queues_tx = am335x_usb_queues_tx, .td_queue = { .submit = 31, .complete = 0 }, @@ -1053,7 +1051,7 @@ static int cppi41_dma_probe(struct platform_device *pdev) goto err_irq; } - ret = devm_request_irq(&pdev->dev, irq, glue_info->isr, IRQF_SHARED, + ret = devm_request_irq(&pdev->dev, irq, cppi41_irq, IRQF_SHARED, dev_name(dev), cdd); if (ret) goto err_irq;