Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752171AbcDULYw (ORCPT ); Thu, 21 Apr 2016 07:24:52 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:53203 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751520AbcDULYu (ORCPT ); Thu, 21 Apr 2016 07:24:50 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Peter Griffin , linux-kernel@vger.kernel.org, srinivas.kandagatla@gmail.com, maxime.coquelin@st.com, patrice.chotard@st.com, vinod.koul@intel.com, devicetree@vger.kernel.org, broonie@kernel.org, dmaengine@vger.kernel.org, lee.jones@linaro.org, ludovic.barre@st.com Subject: Re: [PATCH 03/18] dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support Date: Thu, 21 Apr 2016 13:24:06 +0200 Message-ID: <3845018.6KSEIV4jzU@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1461236675-10176-4-git-send-email-peter.griffin@linaro.org> References: <1461236675-10176-1-git-send-email-peter.griffin@linaro.org> <1461236675-10176-4-git-send-email-peter.griffin@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:eacVU9JV2rvyzjOnPOBWtpE92LhktrAQwXTEdoHjhvHMGgQ08nr Cf5kLImehQXXrwxDAf+lX62h65oUPwlgrJr+y0wtzM+I9D5BdMakVIsVfygnrGq2v5uWMC4 xZ2J9jK5+j9R6teCsMJiICt32gL7oqZXtNn9ec6o+5eFBEiuQggPAYklneQD6weHDeBwKiq CVyU7Db8WHk/FQs9YBI0g== X-UI-Out-Filterresults: notjunk:1;V01:K0:kWbei8I5i0k=:fhIl6A7ZrWE0wC4lZwSYYO GvVp7k0r74AqBw1+NXO7ta1K0yXRnNnlM9/3/xPABA/mUnRtYFctr5e+x8+Wk3uTaM4NSb+4B ll+M25FjBdpuHf1lkelA80gNt1RGayy1/GVVPhOvSJ0xfOU/9vMvGFkKPO7SNQ/K+koKDohIb +KU+3hq5H0cuT3NOQK1dbCJMCP770BlqcQunTIbzxgMBYfeXilaXgHnagg5BgZBb0pSaa6drF +CFvdCa3PBEeWrQKkgBP2lAHH2wO+e0DiFBsYrmXHDmDLCElE3QnZS/E8vkJ7RVPzDPnT3HuF RDlCHOIZ+CkakZoHK42M5IQ9dF66HgqqTh2H7TaBwi9Q2mhcamE8OnmhIPAYi2283DolqtY/v GLMkA/8uPH0GMDqEHWCrFRclbHzbx8rXUxSwpREz71ldW4OUAOuxxHb0OOkfPdu2zipused8+ izukwdw3y8sHubnjFfcTAB9yehJG/Hqfuv4sYnHmgNMWzNbU1eb9IkFBHxcY7WaV2tj/9Mb3p OQucCDFj15QC0fGc/nB9+6E99z6ArmIvg5M+EEZHI1k/4ZIhNT+KW4OLCQ0W+eeOnpJ8Zxkin /fDLZgRt6prYLR4ANxvDBNLd1m47+iAH5vkKqsafy/VzZwdHgjF13UXlkJ6IxauBl/Ce1mtvY lBaH9ZWUnij6ZBrW9Kg2t2eeJxrpXnOFRfP/ZNwiNJWCD4yiLUj0/vGxqAWzPLjPy1TOuCDOZ WSPrsMLYSTcHpVeM Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2351 Lines: 70 On Thursday 21 April 2016 12:04:20 Peter Griffin wrote: > This patch adds support for the Flexible Direct Memory Access (FDMA) core > driver. The FDMA is a slim core CPU with a dedicated firmware. > It is a general purpose DMA controller capable of supporting 16 > independent DMA channels. Data moves maybe from memory to memory > or between memory and paced latency critical real time targets and it > is found on al STi based chipsets. > > Signed-off-by: Ludovic Barre > Signed-off-by: Peter Griffin > --- > drivers/dma/Kconfig | 12 + > drivers/dma/Makefile | 1 + > drivers/dma/st_fdma.c | 967 ++++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 980 insertions(+) > create mode 100644 drivers/dma/st_fdma.c > > diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig > index d96d87c..5910c4f 100644 > --- a/drivers/dma/Kconfig > +++ b/drivers/dma/Kconfig > @@ -527,6 +527,18 @@ config ZX_DMA > help > Support the DMA engine for ZTE ZX296702 platform devices. > > +config ST_FDMA > + tristate "ST FDMA dmaengine support" > + depends on ARCH_STI Try to ensure that the driver builds on x86 (possibly adding further dependencies if needed), then make this depends on ARCH_STI || COMPILE_TEST to get better build coverage. > +static struct dma_chan *st_fdma_of_xlate(struct of_phandle_args *dma_spec, > + struct of_dma *ofdma) > +{ > + struct st_fdma_dev *fdev = ofdma->of_dma_data; > + struct st_fdma_cfg cfg; > + > + if (dma_spec->args_count < 1) > + return NULL; > + > + cfg.of_node = dma_spec->np; > + cfg.req_line = dma_spec->args[0]; > + cfg.req_ctrl = 0; > + cfg.type = ST_FDMA_TYPE_FREE_RUN; > + > + if (dma_spec->args_count > 1) > + cfg.req_ctrl = dma_spec->args[1] & REQ_CTRL_CFG_MASK; > + > + if (dma_spec->args_count > 2) > + cfg.type = dma_spec->args[2]; > + > + dev_dbg(fdev->dev, "xlate req_line:%d type:%d req_ctrl:%#lx\n", > + cfg.req_line, cfg.type, cfg.req_ctrl); > + > + return dma_request_channel(fdev->dma_device.cap_mask, > + st_fdma_filter_fn, &cfg); > +} No need to look at all DMA channels in the system here with dma_request_channel(). Just call dma_get_any_slave_channel() to get the first available channel for this engine, then set the configuration right in that channel data while parsing the DT properties. Arnd