Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753190AbcDUO6a (ORCPT ); Thu, 21 Apr 2016 10:58:30 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:35491 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753170AbcDUO61 (ORCPT ); Thu, 21 Apr 2016 10:58:27 -0400 Date: Thu, 21 Apr 2016 15:58:22 +0100 From: Peter Griffin To: Appana Durga Kedareswara Rao Cc: "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "srinivas.kandagatla@gmail.com" , "maxime.coquelin@st.com" , "patrice.chotard@st.com" , "vinod.koul@intel.com" , "lee.jones@linaro.org" , "dmaengine@vger.kernel.org" , "devicetree@vger.kernel.org" , "arnd@arndb.de" , "broonie@kernel.org" , "ludovic.barre@st.com" , Appana Durga Kedareswara Rao Subject: Re: [PATCH 03/18] dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support Message-ID: <20160421145822.GA1725@griffinp-ThinkPad-X1-Carbon-2nd> 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4649 Lines: 149 Hi Appana, Thanks for the review. On Thu, 21 Apr 2016, Appana Durga Kedareswara Rao wrote: > > > > -----Original Message----- > > From: dmaengine-owner@vger.kernel.org [mailto:dmaengine- > > owner@vger.kernel.org] On Behalf Of Peter Griffin > > Sent: Thursday, April 21, 2016 4:34 PM > > To: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > > srinivas.kandagatla@gmail.com; maxime.coquelin@st.com; > > patrice.chotard@st.com; vinod.koul@intel.com > > Cc: peter.griffin@linaro.org; lee.jones@linaro.org; > > dmaengine@vger.kernel.org; devicetree@vger.kernel.org; arnd@arndb.de; > > broonie@kernel.org; ludovic.barre@st.com > > Subject: [PATCH 03/18] dmaengine: st_fdma: Add STMicroelectronics FDMA > > engine driver support > > > > 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 > > + select DMA_ENGINE > > + select FW_LOADER > > + select DMA_VIRTUAL_CHANNELS > > + help > > + Enable support for ST FDMA controller. > > + It supports 16 independent DMA channels, accepts up to 32 DMA > > requests > > + > > + Say Y here if you have such a chipset. > > + If unsure, say N. > > > > # driver files > > source "drivers/dma/bestcomm/Kconfig" > > diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile > > index 6084127..b81ca99 100644 > > --- a/drivers/dma/Makefile > > +++ b/drivers/dma/Makefile > > @@ -65,6 +65,7 @@ obj-$(CONFIG_TI_DMA_CROSSBAR) += ti-dma-crossbar.o > > obj-$(CONFIG_TI_EDMA) += edma.o > > obj-$(CONFIG_XGENE_DMA) += xgene-dma.o > > obj-$(CONFIG_ZX_DMA) += zx296702_dma.o > > +obj-$(CONFIG_ST_FDMA) += st_fdma.o > > > > obj-y += qcom/ > > obj-y += xilinx/ > > diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c > > new file mode 100644 > > index 0000000..9bf0100 > > --- /dev/null > > +++ b/drivers/dma/st_fdma.c > > @@ -0,0 +1,967 @@ > > +/* > > + * st_fdma.c > > + * > > + * Copyright (C) 2014 STMicroelectronics > > + * Author: Ludovic Barre > > + * License terms: GNU General Public License (GPL), version 2 > > + */ > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include "st_fdma.h" > > +#include "dmaengine.h" > > +#include "virt-dma.h" > > + > > +static char *fdma_clk_name[CLK_MAX_NUM] = { > > + [CLK_SLIM] = "fdma_slim", > > + [CLK_HI] = "fdma_hi", > > + [CLK_LOW] = "fdma_low", > > + [CLK_IC] = "fdma_ic", > > +}; > > + > > +static int st_fdma_clk_get(struct st_fdma_dev *fdev) > > +{ > > + int i; > > + > > + for (i = 0; i < CLK_MAX_NUM; i++) { > > + fdev->clks[i] = devm_clk_get(fdev->dev, fdma_clk_name[i]); > > + if (IS_ERR(fdev->clks[i])) { > > + dev_err(fdev->dev, > > + "failed to get clock: %s\n", fdma_clk_name[i]); > > + return PTR_ERR(fdev->clks[i]); > > + } > > + } > > + > > + if (i != CLK_MAX_NUM) { > > + dev_err(fdev->dev, "all clocks are not defined\n"); > > + return -EINVAL; > > + } > > + > > + return 0; > > +} > > + > > +static int st_fdma_clk_enable(struct st_fdma_dev *fdev) > > +{ > > + int i, ret; > > + > > + for (i = 0; i < CLK_MAX_NUM; i++) { > > + ret = clk_prepare_enable(fdev->clks[i]); > > + if (ret < 0) > > You should disable and unprepared the other clocks... Good point, will fix in v4. regards, Perer