From patchwork Thu Jan 19 10:37:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91849 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp210411qgi; Thu, 19 Jan 2017 02:37:53 -0800 (PST) X-Received: by 10.98.81.199 with SMTP id f190mr9072632pfb.180.1484822273674; Thu, 19 Jan 2017 02:37:53 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si3151340pgc.160.2017.01.19.02.37.53; Thu, 19 Jan 2017 02:37:53 -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 S1751571AbdASKhu (ORCPT + 4 others); Thu, 19 Jan 2017 05:37:50 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:35605 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751727AbdASKhs (ORCPT ); Thu, 19 Jan 2017 05:37:48 -0500 Received: by mail-wm0-f52.google.com with SMTP id r126so283673619wmr.0 for ; Thu, 19 Jan 2017 02:37:11 -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=hYYcBglVTanXtqe5rvy40m+3BqRNR1SYNTG0EEQ2kYefFXHyheGcRja8mt+VMGyZ5F OYWrnAPCi5Wz1w+F7LdUI1XRoedKxe3221b+ngyr5gO+UhxI3FFxJz3hogi4fL9L+LsU OVrPOIvx4JyMyIMzBrAUs4pnONgGQdAaA9v64RMmgPZVDBghW8jFnDMwHEBBrw90iFMo OrIpkdR3w9WWiPJJPs8el4WjFUpRhn5F58LG3waA01Efjbz5C2URcPTJHy6ATDo9l83l UHMjQc2maZzU1glH2UTCIHwh1nFLkirx1eSbN9K4JXImkHHdGPd9HNgM41uvCSGWggO0 TEHQ== 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=U+G1q/9M3SZ9UHV+2XwaXEA0vI/PL4eqnVlViSNJADKlqONhnGlSnN14vWRbJMeUxq 1Roq/NcqOWuuhYzuQTgkaxPf9Oo+NvW/a84/Xxmbz1lcBY2VygTb0Wr/g7204Xq/F7lk 21Ws3fzCG7HWRxFFeDrbNLiw1OeApe+eZmpheYdZucWgRbXstaRtfHpMmuEevB86wAFN +DxHoN7CFKkD1LJRWsYV/rEcRIt8vZ8WUjg/tdCDoSCPNgIdP8Q2lSlFnF23I/1G2bi1 H7MZqCJbs/aZaMUcLcQuhXjvCaYod7knKw6qYAisHWYm55Vy2pdEe+5fYh5lDF4anAUC /oTA== X-Gm-Message-State: AIkVDXIHJWyeU9hjHKRK6Dnvt99vbLVl+atoub2Pn5ADVg5KFPonnUROW6gdMPy6FOokBD1Y X-Received: by 10.223.178.87 with SMTP id y23mr6520129wra.91.1484822230504; Thu, 19 Jan 2017 02:37:10 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c81sm11850470wmf.22.2017.01.19.02.37.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 02:37:10 -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, grygorii.strashko@ti.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v3 1/4] dmaengine: cppi41: Remove usbss_mem Date: Thu, 19 Jan 2017 11:37:02 +0100 Message-Id: <20170119103705.13532-2-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170119103705.13532-1-abailon@baylibre.com> References: <20170119103705.13532-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 Thu Jan 19 10:37:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91852 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp210457qgi; Thu, 19 Jan 2017 02:38:00 -0800 (PST) X-Received: by 10.98.17.4 with SMTP id z4mr9282323pfi.43.1484822280828; Thu, 19 Jan 2017 02:38:00 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si3151340pgc.160.2017.01.19.02.38.00; Thu, 19 Jan 2017 02:38:00 -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 S1751815AbdASKh4 (ORCPT + 4 others); Thu, 19 Jan 2017 05:37:56 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:38551 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751820AbdASKhs (ORCPT ); Thu, 19 Jan 2017 05:37:48 -0500 Received: by mail-wm0-f53.google.com with SMTP id r144so70315996wme.1 for ; Thu, 19 Jan 2017 02:37:12 -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=EFTJebVCIFJv8GLbi1FpS1VFIO12Hk4SUfoALts/dK8LSbVKlWSI62EWy16OUBZOCr twGt2cb2kO1Bp89s7LjzlRH1LO3pJ219o/xkutIupuTzVFjPydjPAKAYwF4syYK8y2cb GtX2WcMN3p58Txs8qtBo57/cY9isMQNn/7AkOkNDAT8bsfdR847bcp1DyGnQjWrT0/2o EH5178XKb+3lZqnZN7T7xHeiwmlDGnvgC/emvWelOP/0W66ZBnrhlVio2Fe8m+3SSnQl KamfkBOazDkbQyvSmMaiDv2mA+OhDl8NCzglb97+ruevl3XI9JnfT4I4HD5CnV+Gj1Bc P8Fw== 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=Ioh7/w8OUDhHTsn/ubV/heovm/OsoW1ZXWMLktmFiviWDQZg4j4+I3zGDRC9To71hT W2wRujJt0sG9YdLZ6jjdyC+hKJp28lnpQ9WPMGcdFvJyk3ePguanyD9a0Sul2VgmpQ+W oz68HJpRFtcOAQrzK1sZwZB76bhK7UkidLJZh/KBAhsVecYga8rHGCFaQ+L3uLyjFfjj FlzjQYiYCxkYTScxFAl8xLrxj9RaJ08Zv2wZyM4JpDo0+xXNHJOpqpPnTpwgrdfK9nlT DMh91/jATqw5+uT+e0wzpYSVubRQB4oFGarH+vaM2l60XLxgC4nP3mYvBjrcCLpcCmWf yoNA== X-Gm-Message-State: AIkVDXKwMB6vVESm532C2PXm0OooL9un2GTVWaln+KS3uBtF8lPV/IFFzfW3Brt87jvQe5v7 X-Received: by 10.28.0.73 with SMTP id 70mr2422106wma.109.1484822231415; Thu, 19 Jan 2017 02:37:11 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c81sm11850470wmf.22.2017.01.19.02.37.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 02:37:10 -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, grygorii.strashko@ti.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v3 2/4] dmaengine: cppi41: rename platform variables Date: Thu, 19 Jan 2017 11:37:03 +0100 Message-Id: <20170119103705.13532-3-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170119103705.13532-1-abailon@baylibre.com> References: <20170119103705.13532-1-abailon@baylibre.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@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-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/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 Thu Jan 19 10:37: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: 91850 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp210429qgi; Thu, 19 Jan 2017 02:37:57 -0800 (PST) X-Received: by 10.99.53.195 with SMTP id c186mr9491833pga.24.1484822277173; Thu, 19 Jan 2017 02:37:57 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si3151340pgc.160.2017.01.19.02.37.57; Thu, 19 Jan 2017 02:37:57 -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 S1751929AbdASKhx (ORCPT + 4 others); Thu, 19 Jan 2017 05:37:53 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35631 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751832AbdASKhs (ORCPT ); Thu, 19 Jan 2017 05:37:48 -0500 Received: by mail-wm0-f41.google.com with SMTP id r126so283674725wmr.0 for ; Thu, 19 Jan 2017 02:37: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=zqlx2L9FqIkb80KY+NzpHNmM4rVVILFSS4Q0xwecWWM=; b=12fwVbutM4XSrnc7qRvVqDyk/XauuD/bMcuJf4NactHoz4WH8wJIF74RxaFJiOcUsw OS7xkUKqMkQOuz4ukF2/sIHwITDidAVch1KthLDj7Lw5XAsL8RMMVCo+4lVBPRP4T7z6 nc9LOKlpl+CyDKbVB3fivwV14Qu+gKb0gFaGpMlmepQ24Xtjkzvdhy9vrh6+cDnu5wOr l0qOIEMhlQarSm3x6TaUT91Gh5O34f2ftRIN6tsQ58DvcomMOahtTdL+guPzbU2lHnJa qH/nQNpIzr85QR5L9XXX7U5uvdUtIHxUtz7+d5BKceRerzEFLS2daNIfTnAs2M7b9JCh GKNw== 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=thjV86hMQ7K2GXIMMKv+QJJ2Dj4/s/87x4rjuEAElqDO0Y8xnc5GMDjCfBytNBYCn/ YlCRG/qRoCunK0ecO2FH87P+iBrBzHgm+evlcbme7Jz8pUAZl44aiYT1WRZWMPTEykNE rPtOZb+SIT0DJX1TrWNJwVaYZWG/rXNEFCyspXXiMQ1UfRMKnOElXlnKTscJ0MoD09YO 5/UQeXoNPqN7tqq3AAxvhldbBpkHONo/4gXstWJz7YMY0XdY52ZjMv+OZPlqQXdbQ3N8 CIZzXvXmCTrhpW1ZYfEi5nvLQs6QYD/iiqTSDKDYyLTv6nrLBDuQtNnlt6CPN2fN/hSS qj1g== X-Gm-Message-State: AIkVDXIf8ZKXRn0Fh159uvIFV8VZ59agDdgs1XIjMS5j9NlFu+grQehvNSITPOz75+k9GWiK X-Received: by 10.223.177.134 with SMTP id q6mr6785522wra.83.1484822232459; Thu, 19 Jan 2017 02:37:12 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c81sm11850470wmf.22.2017.01.19.02.37.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 02:37:11 -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, grygorii.strashko@ti.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v3 3/4] dmaengine: cppi41: Move some constants to glue layer Date: Thu, 19 Jan 2017 11:37:04 +0100 Message-Id: <20170119103705.13532-4-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170119103705.13532-1-abailon@baylibre.com> References: <20170119103705.13532-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 Thu Jan 19 10:37:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91851 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp210442qgi; Thu, 19 Jan 2017 02:37:58 -0800 (PST) X-Received: by 10.84.224.199 with SMTP id k7mr12447486pln.25.1484822278908; Thu, 19 Jan 2017 02:37:58 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si3151340pgc.160.2017.01.19.02.37.58; Thu, 19 Jan 2017 02:37:58 -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 S1751554AbdASKh5 (ORCPT + 4 others); Thu, 19 Jan 2017 05:37:57 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35642 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751892AbdASKhs (ORCPT ); Thu, 19 Jan 2017 05:37:48 -0500 Received: by mail-wm0-f49.google.com with SMTP id r126so283675255wmr.0 for ; Thu, 19 Jan 2017 02:37: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; bh=4MwFrA1m2rCFCokWEo0ZGTAb0UoDmd52FnYJwH0gQs8=; b=LYD9gDAP+QYiyPGe5vw3ISVh5rjt2XagSJf7Dssw19kj+ceNcQalspkX010k8c71mH NA8jZ82hdLZ/5uYBEzeCtUkK44+TlSaQuZFCCVJC/zimhYU0y9CGq2+TBBlm2NpGeARY EoMYDa43do6KeQ9XMlHtfQpV/QiNgYPDzMyj7F5R53IbC8WPIUd3BPZkU9eecIXIV6EF WtmP95r5LSRJjmbM+Bh6NAQJurS4cM0r45sX2wy40NG136GAdqHulCgfyZ0kkgMzAw9N 3JkJimcuZKNvAU0Lzog2OMj7uXeNXo2cKL1bV45p6xrnFY3CbNHmEGGTYu87qr++OkCC SKpA== 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=4MwFrA1m2rCFCokWEo0ZGTAb0UoDmd52FnYJwH0gQs8=; b=elncvRo9bHPYyXvfSI/6K8uK2+iqpbp6oM9CAqMIdzluHJlr3QrwYrxK8aPeNI30Qw GrvM0a9o52Ycd6BmzZtb/ULa8FH8Skbi7yQ2B3HdtEx2uYnjIk7cL6gewBNolLwhMo5S MujDEC0iK9LNaorKy1qVHXmEpU+8iOZPZyopTnUoJr9B/NxN9g1V+LPk4Jaqm3y/QDCS ffMLlHbRzdb2GCsQseb5mHZYNQJ/RBz/3ye9RxL0G6foFeA8fXAKxyNre09pIywx1L+W FFws38N+OmijNoM2zAM67NkgpDSl6NSuni4w2niLFAOb7zVuu95c5PJP3paj4mkE7FrH B8zg== X-Gm-Message-State: AIkVDXKOLq4d+sPwYibmXdeTwShfDQbemz08ycW3SAEOxBCNkxjJkP3ABsW0BOZMbJBBKFMZ X-Received: by 10.223.166.137 with SMTP id t9mr6818821wrc.15.1484822233375; Thu, 19 Jan 2017 02:37:13 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c81sm11850470wmf.22.2017.01.19.02.37.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 02:37:12 -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, grygorii.strashko@ti.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v3 4/4] dmaengine: cppi41: init_sched(): Get number of channels from DT Date: Thu, 19 Jan 2017 11:37:05 +0100 Message-Id: <20170119103705.13532-5-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170119103705.13532-1-abailon@baylibre.com> References: <20170119103705.13532-1-abailon@baylibre.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@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 | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 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/dma/cppi41.c b/drivers/dma/cppi41.c index 5a40653..9767b97 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 void 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,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); } @@ -874,7 +871,8 @@ static int init_cppi41(struct device *dev, struct cppi41_dd *cdd) goto err_td; cppi_writel(cdd->td_queue.submit, cdd->ctrl_mem + DMA_TDFDQ); - init_sched(cdd); + init_sched(dev, 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); @@ -1134,7 +1138,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);