public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] dw_dmac: cleanup for DT usage
@ 2013-03-26 14:53 Andy Shevchenko
  2013-03-26 14:53 ` [PATCH v2 1/4] dw_dmac: fix style of the comments Andy Shevchenko
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Andy Shevchenko @ 2013-03-26 14:53 UTC (permalink / raw)
  To: Vinod Koul, Arnd Bergmann, Viresh Kumar, linux-kernel,
	spear-devel
  Cc: Andy Shevchenko

It includes few cleanups when used with DT. Patch 4/4 is a modified version of
the [1].

[1] http://www.spinics.net/lists/arm-kernel/msg225366.html

Since v1:
 - address Arnd's comments
 - apply Acks I got from Viresh

Andy Shevchenko (3):
  dw_dmac: fix style of the comments
  dw_dmac: rename DT related methods to reflect their belonging
  dw_dmac: make wrapper on of_dma_controller_register()

Arnd Bergmann (1):
  dmaengine: dw_dmac: simplify master selection

 drivers/dma/dw_dmac.c      | 145 +++++++++++++++++++++------------------------
 drivers/dma/dw_dmac_regs.h |   5 +-
 2 files changed, 71 insertions(+), 79 deletions(-)

-- 
1.8.2.rc0.22.gb3600c3


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2 1/4] dw_dmac: fix style of the comments
  2013-03-26 14:53 [PATCH v2 0/4] dw_dmac: cleanup for DT usage Andy Shevchenko
@ 2013-03-26 14:53 ` Andy Shevchenko
  2013-03-26 15:01   ` Arnd Bergmann
  2013-03-26 14:53 ` [PATCH v2 2/4] dw_dmac: rename DT related methods to reflect their belonging Andy Shevchenko
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Andy Shevchenko @ 2013-03-26 14:53 UTC (permalink / raw)
  To: Vinod Koul, Arnd Bergmann, Viresh Kumar, linux-kernel,
	spear-devel
  Cc: Andy Shevchenko

Let's use capital letter as a first one in the comments.
There is no functional changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/dma/dw_dmac.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 43e2e89..d6dbb14 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -173,7 +173,7 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
 		return;
 
 	if (dws && dws->cfg_hi == ~0 && dws->cfg_lo == ~0) {
-		/* autoconfigure based on request line from DT */
+		/* Autoconfigure based on request line from DT */
 		if (dwc->direction == DMA_MEM_TO_DEV)
 			cfghi = DWC_CFGH_DST_PER(dwc->request_line);
 		else if (dwc->direction == DMA_DEV_TO_MEM)
@@ -473,16 +473,16 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
 			(unsigned long long)llp);
 
 	list_for_each_entry_safe(desc, _desc, &dwc->active_list, desc_node) {
-		/* initial residue value */
+		/* Initial residue value */
 		dwc->residue = desc->total_len;
 
-		/* check first descriptors addr */
+		/* Check first descriptors addr */
 		if (desc->txd.phys == llp) {
 			spin_unlock_irqrestore(&dwc->lock, flags);
 			return;
 		}
 
-		/* check first descriptors llp */
+		/* Check first descriptors llp */
 		if (desc->lli.llp == llp) {
 			/* This one is currently in progress */
 			dwc->residue -= dwc_get_sent(dwc);
@@ -588,7 +588,7 @@ inline dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan)
 }
 EXPORT_SYMBOL(dw_dma_get_dst_addr);
 
-/* called with dwc->lock held and all DMAC interrupts disabled */
+/* Called with dwc->lock held and all DMAC interrupts disabled */
 static void dwc_handle_cyclic(struct dw_dma *dw, struct dw_dma_chan *dwc,
 		u32 status_err, u32 status_xfer)
 {
@@ -626,7 +626,7 @@ static void dwc_handle_cyclic(struct dw_dma *dw, struct dw_dma_chan *dwc,
 
 		dwc_chan_disable(dw, dwc);
 
-		/* make sure DMA does not restart by loading a new list */
+		/* Make sure DMA does not restart by loading a new list */
 		channel_writel(dwc, LLP, 0);
 		channel_writel(dwc, CTL_LO, 0);
 		channel_writel(dwc, CTL_HI, 0);
@@ -1256,7 +1256,7 @@ static bool dw_dma_generic_filter(struct dma_chan *chan, void *param)
 	struct dw_dma_filter_args *fargs = param;
 	struct dw_dma_slave *dws = &dwc->slave;
 
-	/* ensure the device matches our channel */
+	/* Ensure the device matches our channel */
         if (chan->device != &fargs->dw->dma)
                 return false;
 
@@ -1323,7 +1323,7 @@ int dw_dma_cyclic_start(struct dma_chan *chan)
 
 	spin_lock_irqsave(&dwc->lock, flags);
 
-	/* assert channel is idle */
+	/* Assert channel is idle */
 	if (dma_readl(dw, CH_EN) & dwc->mask) {
 		dev_err(chan2dev(&dwc->chan),
 			"BUG: Attempted to start non-idle channel\n");
@@ -1335,7 +1335,7 @@ int dw_dma_cyclic_start(struct dma_chan *chan)
 	dma_writel(dw, CLEAR.ERROR, dwc->mask);
 	dma_writel(dw, CLEAR.XFER, dwc->mask);
 
-	/* setup DMAC channel registers */
+	/* Setup DMAC channel registers */
 	channel_writel(dwc, LLP, dwc->cdesc->desc[0]->txd.phys);
 	channel_writel(dwc, CTL_LO, DWC_CTLL_LLP_D_EN | DWC_CTLL_LLP_S_EN);
 	channel_writel(dwc, CTL_HI, 0);
@@ -1502,7 +1502,7 @@ struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
 		last = desc;
 	}
 
-	/* lets make a cyclic list */
+	/* Let's make a cyclic list */
 	last->lli.llp = cdesc->desc[0]->txd.phys;
 
 	dev_dbg(chan2dev(&dwc->chan), "cyclic prepared buf 0x%llx len %zu "
@@ -1707,7 +1707,7 @@ static int dw_probe(struct platform_device *pdev)
 
 	dw->regs = regs;
 
-	/* get hardware configuration parameters */
+	/* Get hardware configuration parameters */
 	if (autocfg) {
 		max_blk_size = dma_readl(dw, MAX_BLK_SIZE);
 
@@ -1729,10 +1729,10 @@ static int dw_probe(struct platform_device *pdev)
 	/* Calculate all channel mask before DMA setup */
 	dw->all_chan_mask = (1 << nr_channels) - 1;
 
-	/* force dma off, just in case */
+	/* Force dma off, just in case */
 	dw_dma_off(dw);
 
-	/* disable BLOCK interrupts as well */
+	/* Disable BLOCK interrupts as well */
 	channel_clear_bit(dw, MASK.BLOCK, dw->all_chan_mask);
 
 	err = devm_request_irq(&pdev->dev, irq, dw_dma_interrupt, 0,
@@ -1742,7 +1742,7 @@ static int dw_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, dw);
 
-	/* create a pool of consistent memory blocks for hardware descriptors */
+	/* Create a pool of consistent memory blocks for hardware descriptors */
 	dw->desc_pool = dmam_pool_create("dw_dmac_desc_pool", &pdev->dev,
 					 sizeof(struct dw_desc), 4, 0);
 	if (!dw->desc_pool) {
@@ -1783,7 +1783,7 @@ static int dw_probe(struct platform_device *pdev)
 
 		dwc->direction = DMA_TRANS_NONE;
 
-		/* hardware configuration */
+		/* Hardware configuration */
 		if (autocfg) {
 			unsigned int dwc_params;
 
-- 
1.8.2.rc0.22.gb3600c3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 2/4] dw_dmac: rename DT related methods to reflect their belonging
  2013-03-26 14:53 [PATCH v2 0/4] dw_dmac: cleanup for DT usage Andy Shevchenko
  2013-03-26 14:53 ` [PATCH v2 1/4] dw_dmac: fix style of the comments Andy Shevchenko
@ 2013-03-26 14:53 ` Andy Shevchenko
  2013-03-26 15:02   ` Arnd Bergmann
  2013-03-26 14:53 ` [PATCH v2 3/4] dw_dmac: make wrapper on of_dma_controller_register() Andy Shevchenko
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Andy Shevchenko @ 2013-03-26 14:53 UTC (permalink / raw)
  To: Vinod Koul, Arnd Bergmann, Viresh Kumar, linux-kernel,
	spear-devel
  Cc: Andy Shevchenko

Since we will have not only DT cases in future let's rename DT related methods
to reflect their belonging.

The rename was done as follows:
	struct dw_dma_filter_args	-> struct dw_dma_of_filter_args
	dw_dma_generic_filter()		-> dw_dma_of_filter()
	dw_dma_xlate()			-> dw_dma_of_xlate()
	dw_dma_id_table			-> dw_dma_of_id_table

There is no functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/dma/dw_dmac.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index d6dbb14..274fd7d 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1242,18 +1242,20 @@ static void dwc_free_chan_resources(struct dma_chan *chan)
 	dev_vdbg(chan2dev(chan), "%s: done\n", __func__);
 }
 
-struct dw_dma_filter_args {
+/*----------------------------------------------------------------------*/
+
+struct dw_dma_of_filter_args {
 	struct dw_dma *dw;
 	unsigned int req;
 	unsigned int src;
 	unsigned int dst;
 };
 
-static bool dw_dma_generic_filter(struct dma_chan *chan, void *param)
+static bool dw_dma_of_filter(struct dma_chan *chan, void *param)
 {
 	struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
 	struct dw_dma *dw = to_dw_dma(chan->device);
-	struct dw_dma_filter_args *fargs = param;
+	struct dw_dma_of_filter_args *fargs = param;
 	struct dw_dma_slave *dws = &dwc->slave;
 
 	/* Ensure the device matches our channel */
@@ -1273,11 +1275,11 @@ static bool dw_dma_generic_filter(struct dma_chan *chan, void *param)
 	return true;
 }
 
-static struct dma_chan *dw_dma_xlate(struct of_phandle_args *dma_spec,
-					 struct of_dma *ofdma)
+static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
+					struct of_dma *ofdma)
 {
 	struct dw_dma *dw = ofdma->of_dma_data;
-	struct dw_dma_filter_args fargs = {
+	struct dw_dma_of_filter_args fargs = {
 		.dw = dw,
 	};
 	dma_cap_mask_t cap;
@@ -1298,7 +1300,7 @@ static struct dma_chan *dw_dma_xlate(struct of_phandle_args *dma_spec,
 	dma_cap_set(DMA_SLAVE, cap);
 
 	/* TODO: there should be a simpler way to do this */
-	return dma_request_channel(cap, dw_dma_generic_filter, &fargs);
+	return dma_request_channel(cap, dw_dma_of_filter, &fargs);
 }
 
 /* --------------------- Cyclic DMA API extensions -------------------- */
@@ -1843,7 +1845,7 @@ static int dw_probe(struct platform_device *pdev)
 
 	if (pdev->dev.of_node) {
 		err = of_dma_controller_register(pdev->dev.of_node,
-						 dw_dma_xlate, dw);
+						 dw_dma_of_xlate, dw);
 		if (err && err != -ENODEV)
 			dev_err(&pdev->dev,
 				"could not register of_dma_controller\n");
@@ -1913,11 +1915,11 @@ static const struct dev_pm_ops dw_dev_pm_ops = {
 };
 
 #ifdef CONFIG_OF
-static const struct of_device_id dw_dma_id_table[] = {
+static const struct of_device_id dw_dma_of_id_table[] = {
 	{ .compatible = "snps,dma-spear1340" },
 	{}
 };
-MODULE_DEVICE_TABLE(of, dw_dma_id_table);
+MODULE_DEVICE_TABLE(of, dw_dma_of_id_table);
 #endif
 
 static const struct platform_device_id dw_dma_ids[] = {
@@ -1933,7 +1935,7 @@ static struct platform_driver dw_driver = {
 	.driver = {
 		.name	= "dw_dmac",
 		.pm	= &dw_dev_pm_ops,
-		.of_match_table = of_match_ptr(dw_dma_id_table),
+		.of_match_table = of_match_ptr(dw_dma_of_id_table),
 	},
 	.id_table	= dw_dma_ids,
 };
-- 
1.8.2.rc0.22.gb3600c3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 3/4] dw_dmac: make wrapper on of_dma_controller_register()
  2013-03-26 14:53 [PATCH v2 0/4] dw_dmac: cleanup for DT usage Andy Shevchenko
  2013-03-26 14:53 ` [PATCH v2 1/4] dw_dmac: fix style of the comments Andy Shevchenko
  2013-03-26 14:53 ` [PATCH v2 2/4] dw_dmac: rename DT related methods to reflect their belonging Andy Shevchenko
@ 2013-03-26 14:53 ` Andy Shevchenko
  2013-03-26 15:01   ` Arnd Bergmann
  2013-03-26 15:04   ` Lars-Peter Clausen
  2013-03-26 14:53 ` [PATCH v2 4/4] dmaengine: dw_dmac: simplify master selection Andy Shevchenko
  2013-04-01 17:55 ` [PATCH v2 0/4] dw_dmac: cleanup for DT usage Vinod Koul
  4 siblings, 2 replies; 19+ messages in thread
From: Andy Shevchenko @ 2013-03-26 14:53 UTC (permalink / raw)
  To: Vinod Koul, Arnd Bergmann, Viresh Kumar, linux-kernel,
	spear-devel
  Cc: Andy Shevchenko

This patch introduces new method dw_dma_of_controller_register() and adds
checks of the of_node presence together with CONFIG_OF before calling the
wrapper. It helps to distinguish the real -ENODEV return code of fake one when
of_dma_controller_register is not implemented.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw_dmac.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 274fd7d..c1f017b 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1303,6 +1303,16 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
 	return dma_request_channel(cap, dw_dma_of_filter, &fargs);
 }
 
+static void dw_dma_of_controller_register(struct dw_dma *dw)
+{
+	struct device *dev = dw->dma.dev;
+	int err;
+
+	err = of_dma_controller_register(dev->of_node, dw_dma_of_xlate, dw);
+	if (err)
+		dev_err(dev, "could not register of_dma_controller\n");
+}
+
 /* --------------------- Cyclic DMA API extensions -------------------- */
 
 /**
@@ -1843,13 +1853,8 @@ static int dw_probe(struct platform_device *pdev)
 
 	dma_async_device_register(&dw->dma);
 
-	if (pdev->dev.of_node) {
-		err = of_dma_controller_register(pdev->dev.of_node,
-						 dw_dma_of_xlate, dw);
-		if (err && err != -ENODEV)
-			dev_err(&pdev->dev,
-				"could not register of_dma_controller\n");
-	}
+	if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
+		dw_dma_of_controller_register(dw);
 
 	return 0;
 }
-- 
1.8.2.rc0.22.gb3600c3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 4/4] dmaengine: dw_dmac: simplify master selection
  2013-03-26 14:53 [PATCH v2 0/4] dw_dmac: cleanup for DT usage Andy Shevchenko
                   ` (2 preceding siblings ...)
  2013-03-26 14:53 ` [PATCH v2 3/4] dw_dmac: make wrapper on of_dma_controller_register() Andy Shevchenko
@ 2013-03-26 14:53 ` Andy Shevchenko
  2013-03-26 15:02   ` Arnd Bergmann
  2013-04-01 17:55 ` [PATCH v2 0/4] dw_dmac: cleanup for DT usage Vinod Koul
  4 siblings, 1 reply; 19+ messages in thread
From: Andy Shevchenko @ 2013-03-26 14:53 UTC (permalink / raw)
  To: Vinod Koul, Arnd Bergmann, Viresh Kumar, linux-kernel,
	spear-devel
  Cc: Andy Shevchenko, linux-arm-kernel

From: Arnd Bergmann <arnd@arndb.de>

The patch to add the common DMA binding added a dummy dw_dma_slave
structure into the dw_dma_chan structure in order to configure the
masters correctly. It turns out that this can be simplified if we
pick the DMA masters in the dwc_alloc_chan_resources function instead
and save them in the dw_dma_chan structure directly.

This could be simplified further once all users that today use
dw_dma_slave for configuration get converted to device tree based
setup instead.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/dma/dw_dmac.c      | 76 ++++++++++++++++++----------------------------
 drivers/dma/dw_dmac_regs.h |  5 ++-
 2 files changed, 33 insertions(+), 48 deletions(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index c1f017b..5c9fec6 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -49,29 +49,22 @@ static inline unsigned int dwc_get_sms(struct dw_dma_slave *slave)
 	return slave ? slave->src_master : 1;
 }
 
-#define SRC_MASTER	0
-#define DST_MASTER	1
-
-static inline unsigned int dwc_get_master(struct dma_chan *chan, int master)
+static inline void dwc_set_masters(struct dw_dma_chan *dwc)
 {
-	struct dw_dma *dw = to_dw_dma(chan->device);
-	struct dw_dma_slave *dws = chan->private;
-	unsigned int m;
-
-	if (master == SRC_MASTER)
-		m = dwc_get_sms(dws);
-	else
-		m = dwc_get_dms(dws);
+	struct dw_dma *dw = to_dw_dma(dwc->chan.device);
+	struct dw_dma_slave *dws = dwc->chan.private;
+	unsigned char mmax = dw->nr_masters - 1;
 
-	return min_t(unsigned int, dw->nr_masters - 1, m);
+	if (dwc->request_line == ~0) {
+		dwc->src_master = min_t(unsigned char, mmax, dwc_get_sms(dws));
+		dwc->dst_master = min_t(unsigned char, mmax, dwc_get_dms(dws));
+	}
 }
 
 #define DWC_DEFAULT_CTLLO(_chan) ({				\
 		struct dw_dma_chan *_dwc = to_dw_dma_chan(_chan);	\
 		struct dma_slave_config	*_sconfig = &_dwc->dma_sconfig;	\
 		bool _is_slave = is_slave_direction(_dwc->direction);	\
-		int _dms = dwc_get_master(_chan, DST_MASTER);		\
-		int _sms = dwc_get_master(_chan, SRC_MASTER);		\
 		u8 _smsize = _is_slave ? _sconfig->src_maxburst :	\
 			DW_DMA_MSIZE_16;			\
 		u8 _dmsize = _is_slave ? _sconfig->dst_maxburst :	\
@@ -81,8 +74,8 @@ static inline unsigned int dwc_get_master(struct dma_chan *chan, int master)
 		 | DWC_CTLL_SRC_MSIZE(_smsize)			\
 		 | DWC_CTLL_LLP_D_EN				\
 		 | DWC_CTLL_LLP_S_EN				\
-		 | DWC_CTLL_DMS(_dms)				\
-		 | DWC_CTLL_SMS(_sms));				\
+		 | DWC_CTLL_DMS(_dwc->dst_master)		\
+		 | DWC_CTLL_SMS(_dwc->src_master));		\
 	})
 
 /*
@@ -92,13 +85,6 @@ static inline unsigned int dwc_get_master(struct dma_chan *chan, int master)
  */
 #define NR_DESCS_PER_CHANNEL	64
 
-static inline unsigned int dwc_get_data_width(struct dma_chan *chan, int master)
-{
-	struct dw_dma *dw = to_dw_dma(chan->device);
-
-	return dw->data_width[dwc_get_master(chan, master)];
-}
-
 /*----------------------------------------------------------------------*/
 
 static struct device *chan2dev(struct dma_chan *chan)
@@ -172,13 +158,7 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
 	if (dwc->initialized == true)
 		return;
 
-	if (dws && dws->cfg_hi == ~0 && dws->cfg_lo == ~0) {
-		/* Autoconfigure based on request line from DT */
-		if (dwc->direction == DMA_MEM_TO_DEV)
-			cfghi = DWC_CFGH_DST_PER(dwc->request_line);
-		else if (dwc->direction == DMA_DEV_TO_MEM)
-			cfghi = DWC_CFGH_SRC_PER(dwc->request_line);
-	} else if (dws) {
+	if (dws) {
 		/*
 		 * We need controller-specific data to set up slave
 		 * transfers.
@@ -189,9 +169,9 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
 		cfglo |= dws->cfg_lo & ~DWC_CFGL_CH_PRIOR_MASK;
 	} else {
 		if (dwc->direction == DMA_MEM_TO_DEV)
-			cfghi = DWC_CFGH_DST_PER(dwc->dma_sconfig.slave_id);
+			cfghi = DWC_CFGH_DST_PER(dwc->request_line);
 		else if (dwc->direction == DMA_DEV_TO_MEM)
-			cfghi = DWC_CFGH_SRC_PER(dwc->dma_sconfig.slave_id);
+			cfghi = DWC_CFGH_SRC_PER(dwc->request_line);
 	}
 
 	channel_writel(dwc, CFG_LO, cfglo);
@@ -745,6 +725,7 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 		size_t len, unsigned long flags)
 {
 	struct dw_dma_chan	*dwc = to_dw_dma_chan(chan);
+	struct dw_dma		*dw = to_dw_dma(chan->device);
 	struct dw_desc		*desc;
 	struct dw_desc		*first;
 	struct dw_desc		*prev;
@@ -767,8 +748,8 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 
 	dwc->direction = DMA_MEM_TO_MEM;
 
-	data_width = min_t(unsigned int, dwc_get_data_width(chan, SRC_MASTER),
-			   dwc_get_data_width(chan, DST_MASTER));
+	data_width = min_t(unsigned int, dw->data_width[dwc->src_master],
+			   dw->data_width[dwc->dst_master]);
 
 	src_width = dst_width = min_t(unsigned int, data_width,
 				      dwc_fast_fls(src | dest | len));
@@ -826,6 +807,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 		unsigned long flags, void *context)
 {
 	struct dw_dma_chan	*dwc = to_dw_dma_chan(chan);
+	struct dw_dma		*dw = to_dw_dma(chan->device);
 	struct dma_slave_config	*sconfig = &dwc->dma_sconfig;
 	struct dw_desc		*prev;
 	struct dw_desc		*first;
@@ -859,7 +841,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 		ctllo |= sconfig->device_fc ? DWC_CTLL_FC(DW_DMA_FC_P_M2P) :
 			DWC_CTLL_FC(DW_DMA_FC_D_M2P);
 
-		data_width = dwc_get_data_width(chan, SRC_MASTER);
+		data_width = dw->data_width[dwc->src_master];
 
 		for_each_sg(sgl, sg, sg_len, i) {
 			struct dw_desc	*desc;
@@ -919,7 +901,7 @@ slave_sg_todev_fill_desc:
 		ctllo |= sconfig->device_fc ? DWC_CTLL_FC(DW_DMA_FC_P_P2M) :
 			DWC_CTLL_FC(DW_DMA_FC_D_P2M);
 
-		data_width = dwc_get_data_width(chan, DST_MASTER);
+		data_width = dw->data_width[dwc->dst_master];
 
 		for_each_sg(sgl, sg, sg_len, i) {
 			struct dw_desc	*desc;
@@ -1020,6 +1002,10 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
 	memcpy(&dwc->dma_sconfig, sconfig, sizeof(*sconfig));
 	dwc->direction = sconfig->direction;
 
+	/* Take the request line from slave_id member */
+	if (dwc->request_line == ~0)
+		dwc->request_line = sconfig->slave_id;
+
 	convert_burst(&dwc->dma_sconfig.src_maxburst);
 	convert_burst(&dwc->dma_sconfig.dst_maxburst);
 	convert_slave_id(dwc);
@@ -1170,6 +1156,8 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan)
 	 * doesn't mean what you think it means), and status writeback.
 	 */
 
+	dwc_set_masters(dwc);
+
 	spin_lock_irqsave(&dwc->lock, flags);
 	i = dwc->descs_allocated;
 	while (dwc->descs_allocated < NR_DESCS_PER_CHANNEL) {
@@ -1227,6 +1215,7 @@ static void dwc_free_chan_resources(struct dma_chan *chan)
 	list_splice_init(&dwc->free_list, &list);
 	dwc->descs_allocated = 0;
 	dwc->initialized = false;
+	dwc->request_line = ~0;
 
 	/* Disable interrupts */
 	channel_clear_bit(dw, MASK.XFER, dwc->mask);
@@ -1254,23 +1243,15 @@ struct dw_dma_of_filter_args {
 static bool dw_dma_of_filter(struct dma_chan *chan, void *param)
 {
 	struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
-	struct dw_dma *dw = to_dw_dma(chan->device);
 	struct dw_dma_of_filter_args *fargs = param;
-	struct dw_dma_slave *dws = &dwc->slave;
 
 	/* Ensure the device matches our channel */
         if (chan->device != &fargs->dw->dma)
                 return false;
 
-	dws->dma_dev	= dw->dma.dev;
-	dws->cfg_hi	= ~0;
-	dws->cfg_lo	= ~0;
-	dws->src_master	= fargs->src;
-	dws->dst_master	= fargs->dst;
-
 	dwc->request_line = fargs->req;
-
-	chan->private = dws;
+	dwc->src_master	= fargs->src;
+	dwc->dst_master	= fargs->dst;
 
 	return true;
 }
@@ -1794,6 +1775,7 @@ static int dw_probe(struct platform_device *pdev)
 		channel_clear_bit(dw, CH_EN, dwc->mask);
 
 		dwc->direction = DMA_TRANS_NONE;
+		dwc->request_line = ~0;
 
 		/* Hardware configuration */
 		if (autocfg) {
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
index 4d02c36..9b0e12e 100644
--- a/drivers/dma/dw_dmac_regs.h
+++ b/drivers/dma/dw_dmac_regs.h
@@ -212,8 +212,11 @@ struct dw_dma_chan {
 	/* hardware configuration */
 	unsigned int		block_size;
 	bool			nollp;
+
+	/* custom slave configuration */
 	unsigned int		request_line;
-	struct dw_dma_slave	slave;
+	unsigned char		src_master;
+	unsigned char		dst_master;
 
 	/* configuration passed via DMA_SLAVE_CONFIG */
 	struct dma_slave_config dma_sconfig;
-- 
1.8.2.rc0.22.gb3600c3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] dw_dmac: make wrapper on of_dma_controller_register()
  2013-03-26 14:53 ` [PATCH v2 3/4] dw_dmac: make wrapper on of_dma_controller_register() Andy Shevchenko
@ 2013-03-26 15:01   ` Arnd Bergmann
  2013-03-26 15:04   ` Lars-Peter Clausen
  1 sibling, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2013-03-26 15:01 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Vinod Koul, Viresh Kumar, linux-kernel, spear-devel

On Tuesday 26 March 2013, Andy Shevchenko wrote:
> This patch introduces new method dw_dma_of_controller_register() and adds
> checks of the of_node presence together with CONFIG_OF before calling the
> wrapper. It helps to distinguish the real -ENODEV return code of fake one when
> of_dma_controller_register is not implemented.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

Thanks for the update

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 1/4] dw_dmac: fix style of the comments
  2013-03-26 14:53 ` [PATCH v2 1/4] dw_dmac: fix style of the comments Andy Shevchenko
@ 2013-03-26 15:01   ` Arnd Bergmann
  0 siblings, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2013-03-26 15:01 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Vinod Koul, Viresh Kumar, linux-kernel, spear-devel

On Tuesday 26 March 2013, Andy Shevchenko wrote:
> Let's use capital letter as a first one in the comments.
> There is no functional changes.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/4] dw_dmac: rename DT related methods to reflect their belonging
  2013-03-26 14:53 ` [PATCH v2 2/4] dw_dmac: rename DT related methods to reflect their belonging Andy Shevchenko
@ 2013-03-26 15:02   ` Arnd Bergmann
  0 siblings, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2013-03-26 15:02 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Vinod Koul, Viresh Kumar, linux-kernel, spear-devel

On Tuesday 26 March 2013, Andy Shevchenko wrote:
> Since we will have not only DT cases in future let's rename DT related methods
> to reflect their belonging.
> 
> The rename was done as follows:
> 	struct dw_dma_filter_args	-> struct dw_dma_of_filter_args
> 	dw_dma_generic_filter()		-> dw_dma_of_filter()
> 	dw_dma_xlate()			-> dw_dma_of_xlate()
> 	dw_dma_id_table			-> dw_dma_of_id_table
> 
> There is no functional change.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 4/4] dmaengine: dw_dmac: simplify master selection
  2013-03-26 14:53 ` [PATCH v2 4/4] dmaengine: dw_dmac: simplify master selection Andy Shevchenko
@ 2013-03-26 15:02   ` Arnd Bergmann
  0 siblings, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2013-03-26 15:02 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Vinod Koul, Viresh Kumar, linux-kernel, spear-devel,
	linux-arm-kernel

On Tuesday 26 March 2013, Andy Shevchenko wrote:
> 
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The patch to add the common DMA binding added a dummy dw_dma_slave
> structure into the dw_dma_chan structure in order to configure the
> masters correctly. It turns out that this can be simplified if we
> pick the DMA masters in the dwc_alloc_chan_resources function instead
> and save them in the dw_dma_chan structure directly.
> 
> This could be simplified further once all users that today use
> dw_dma_slave for configuration get converted to device tree based
> setup instead.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> Cc: linux-arm-kernel@lists.infradead.org

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] dw_dmac: make wrapper on of_dma_controller_register()
  2013-03-26 14:53 ` [PATCH v2 3/4] dw_dmac: make wrapper on of_dma_controller_register() Andy Shevchenko
  2013-03-26 15:01   ` Arnd Bergmann
@ 2013-03-26 15:04   ` Lars-Peter Clausen
  2013-03-26 16:59     ` Andy Shevchenko
  2013-03-26 17:04     ` [PATCH v2.1] " Andy Shevchenko
  1 sibling, 2 replies; 19+ messages in thread
From: Lars-Peter Clausen @ 2013-03-26 15:04 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Vinod Koul, Arnd Bergmann, Viresh Kumar, linux-kernel,
	spear-devel

On 03/26/2013 03:53 PM, Andy Shevchenko wrote:
> This patch introduces new method dw_dma_of_controller_register() and adds
> checks of the of_node presence together with CONFIG_OF before calling the
> wrapper. It helps to distinguish the real -ENODEV return code of fake one when
> of_dma_controller_register is not implemented.

If CONFIG_OF is not set the of_node of the device will always be NULL. Which
means of_dma_controller_register() will only be called if it is implemented.
So you'll never get the -ENODEV from the of_dma_controller_register() stub.

- Lars

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/dma/dw_dmac.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index 274fd7d..c1f017b 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -1303,6 +1303,16 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
>  	return dma_request_channel(cap, dw_dma_of_filter, &fargs);
>  }
>  
> +static void dw_dma_of_controller_register(struct dw_dma *dw)
> +{
> +	struct device *dev = dw->dma.dev;
> +	int err;
> +
> +	err = of_dma_controller_register(dev->of_node, dw_dma_of_xlate, dw);
> +	if (err)
> +		dev_err(dev, "could not register of_dma_controller\n");
> +}
> +
>  /* --------------------- Cyclic DMA API extensions -------------------- */
>  
>  /**
> @@ -1843,13 +1853,8 @@ static int dw_probe(struct platform_device *pdev)
>  
>  	dma_async_device_register(&dw->dma);
>  
> -	if (pdev->dev.of_node) {
> -		err = of_dma_controller_register(pdev->dev.of_node,
> -						 dw_dma_of_xlate, dw);
> -		if (err && err != -ENODEV)
> -			dev_err(&pdev->dev,
> -				"could not register of_dma_controller\n");
> -	}
> +	if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
> +		dw_dma_of_controller_register(dw);
>  
>  	return 0;
>  }


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/4] dw_dmac: make wrapper on of_dma_controller_register()
  2013-03-26 15:04   ` Lars-Peter Clausen
@ 2013-03-26 16:59     ` Andy Shevchenko
  2013-03-26 17:04     ` [PATCH v2.1] " Andy Shevchenko
  1 sibling, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2013-03-26 16:59 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Vinod Koul, Arnd Bergmann, Viresh Kumar, linux-kernel,
	spear-devel

On Tue, 2013-03-26 at 16:04 +0100, Lars-Peter Clausen wrote: 
> On 03/26/2013 03:53 PM, Andy Shevchenko wrote:
> > This patch introduces new method dw_dma_of_controller_register() and adds
> > checks of the of_node presence together with CONFIG_OF before calling the
> > wrapper. It helps to distinguish the real -ENODEV return code of fake one when
> > of_dma_controller_register is not implemented.
> 
> If CONFIG_OF is not set the of_node of the device will always be NULL. Which
> means of_dma_controller_register() will only be called if it is implemented.
> So you'll never get the -ENODEV from the of_dma_controller_register() stub.

Thanks for clarification, I'll update the patch.


> 
> - Lars
> 
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  drivers/dma/dw_dmac.c | 19 ++++++++++++-------
> >  1 file changed, 12 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> > index 274fd7d..c1f017b 100644
> > --- a/drivers/dma/dw_dmac.c
> > +++ b/drivers/dma/dw_dmac.c
> > @@ -1303,6 +1303,16 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
> >  	return dma_request_channel(cap, dw_dma_of_filter, &fargs);
> >  }
> >  
> > +static void dw_dma_of_controller_register(struct dw_dma *dw)
> > +{
> > +	struct device *dev = dw->dma.dev;
> > +	int err;
> > +
> > +	err = of_dma_controller_register(dev->of_node, dw_dma_of_xlate, dw);
> > +	if (err)
> > +		dev_err(dev, "could not register of_dma_controller\n");
> > +}
> > +
> >  /* --------------------- Cyclic DMA API extensions -------------------- */
> >  
> >  /**
> > @@ -1843,13 +1853,8 @@ static int dw_probe(struct platform_device *pdev)
> >  
> >  	dma_async_device_register(&dw->dma);
> >  
> > -	if (pdev->dev.of_node) {
> > -		err = of_dma_controller_register(pdev->dev.of_node,
> > -						 dw_dma_of_xlate, dw);
> > -		if (err && err != -ENODEV)
> > -			dev_err(&pdev->dev,
> > -				"could not register of_dma_controller\n");
> > -	}
> > +	if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
> > +		dw_dma_of_controller_register(dw);
> >  
> >  	return 0;
> >  }
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2.1] dw_dmac: make wrapper on of_dma_controller_register()
  2013-03-26 15:04   ` Lars-Peter Clausen
  2013-03-26 16:59     ` Andy Shevchenko
@ 2013-03-26 17:04     ` Andy Shevchenko
  2013-03-26 17:07       ` Viresh Kumar
  1 sibling, 1 reply; 19+ messages in thread
From: Andy Shevchenko @ 2013-03-26 17:04 UTC (permalink / raw)
  To: Vinod Koul, Arnd Bergmann, Viresh Kumar, linux-kernel,
	spear-devel, Lars-Peter Clausen
  Cc: Andy Shevchenko

This patch introduces new method dw_dma_of_controller_register(). The wrapper
is called only when of_node is present.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/dma/dw_dmac.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 274fd7d..12657d7 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1303,6 +1303,16 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
 	return dma_request_channel(cap, dw_dma_of_filter, &fargs);
 }
 
+static void dw_dma_of_controller_register(struct dw_dma *dw)
+{
+	struct device *dev = dw->dma.dev;
+	int err;
+
+	err = of_dma_controller_register(dev->of_node, dw_dma_of_xlate, dw);
+	if (err)
+		dev_err(dev, "could not register of_dma_controller\n");
+}
+
 /* --------------------- Cyclic DMA API extensions -------------------- */
 
 /**
@@ -1843,13 +1853,8 @@ static int dw_probe(struct platform_device *pdev)
 
 	dma_async_device_register(&dw->dma);
 
-	if (pdev->dev.of_node) {
-		err = of_dma_controller_register(pdev->dev.of_node,
-						 dw_dma_of_xlate, dw);
-		if (err && err != -ENODEV)
-			dev_err(&pdev->dev,
-				"could not register of_dma_controller\n");
-	}
+	if (pdev->dev.of_node)
+		dw_dma_of_controller_register(dw);
 
 	return 0;
 }
-- 
1.8.2.rc0.22.gb3600c3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v2.1] dw_dmac: make wrapper on of_dma_controller_register()
  2013-03-26 17:04     ` [PATCH v2.1] " Andy Shevchenko
@ 2013-03-26 17:07       ` Viresh Kumar
  2013-03-26 17:12         ` Andy Shevchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Viresh Kumar @ 2013-03-26 17:07 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Vinod Koul, Arnd Bergmann, linux-kernel, spear-devel,
	Lars-Peter Clausen

On 26 March 2013 22:34, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> This patch introduces new method dw_dma_of_controller_register(). The wrapper
> is called only when of_node is present.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/dma/dw_dmac.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index 274fd7d..12657d7 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -1303,6 +1303,16 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
>         return dma_request_channel(cap, dw_dma_of_filter, &fargs);
>  }
>
> +static void dw_dma_of_controller_register(struct dw_dma *dw)
> +{
> +       struct device *dev = dw->dma.dev;
> +       int err;
> +
> +       err = of_dma_controller_register(dev->of_node, dw_dma_of_xlate, dw);
> +       if (err)
> +               dev_err(dev, "could not register of_dma_controller\n");
> +}
> +
>  /* --------------------- Cyclic DMA API extensions -------------------- */
>
>  /**
> @@ -1843,13 +1853,8 @@ static int dw_probe(struct platform_device *pdev)
>
>         dma_async_device_register(&dw->dma);
>
> -       if (pdev->dev.of_node) {
> -               err = of_dma_controller_register(pdev->dev.of_node,
> -                                                dw_dma_of_xlate, dw);
> -               if (err && err != -ENODEV)
> -                       dev_err(&pdev->dev,
> -                               "could not register of_dma_controller\n");
> -       }
> +       if (pdev->dev.of_node)
> +               dw_dma_of_controller_register(dw);

I forgot where we started from, but what's the need of this patch?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2.1] dw_dmac: make wrapper on of_dma_controller_register()
  2013-03-26 17:07       ` Viresh Kumar
@ 2013-03-26 17:12         ` Andy Shevchenko
  2013-03-26 17:16           ` Viresh Kumar
  0 siblings, 1 reply; 19+ messages in thread
From: Andy Shevchenko @ 2013-03-26 17:12 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Vinod Koul, Arnd Bergmann, linux-kernel, spear-devel,
	Lars-Peter Clausen

On Tue, 2013-03-26 at 22:37 +0530, Viresh Kumar wrote: 
> On 26 March 2013 22:34, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > This patch introduces new method dw_dma_of_controller_register(). The wrapper
> > is called only when of_node is present.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  drivers/dma/dw_dmac.c | 19 ++++++++++++-------
> >  1 file changed, 12 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> > index 274fd7d..12657d7 100644
> > --- a/drivers/dma/dw_dmac.c
> > +++ b/drivers/dma/dw_dmac.c
> > @@ -1303,6 +1303,16 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
> >         return dma_request_channel(cap, dw_dma_of_filter, &fargs);
> >  }
> >
> > +static void dw_dma_of_controller_register(struct dw_dma *dw)
> > +{
> > +       struct device *dev = dw->dma.dev;
> > +       int err;
> > +
> > +       err = of_dma_controller_register(dev->of_node, dw_dma_of_xlate, dw);
> > +       if (err)
> > +               dev_err(dev, "could not register of_dma_controller\n");
> > +}
> > +
> >  /* --------------------- Cyclic DMA API extensions -------------------- */
> >
> >  /**
> > @@ -1843,13 +1853,8 @@ static int dw_probe(struct platform_device *pdev)
> >
> >         dma_async_device_register(&dw->dma);
> >
> > -       if (pdev->dev.of_node) {
> > -               err = of_dma_controller_register(pdev->dev.of_node,
> > -                                                dw_dma_of_xlate, dw);
> > -               if (err && err != -ENODEV)
> > -                       dev_err(&pdev->dev,
> > -                               "could not register of_dma_controller\n");
> > -       }
> > +       if (pdev->dev.of_node)
> > +               dw_dma_of_controller_register(dw);
> 
> I forgot where we started from, but what's the need of this patch?

Nowadays, besides removal of the -ENODEV checking, it makes probe
function looks tidier.

Think about upcoming stuff (e.g. ACPI), if we put everything inside
probe it will look overloaded.


-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2.1] dw_dmac: make wrapper on of_dma_controller_register()
  2013-03-26 17:12         ` Andy Shevchenko
@ 2013-03-26 17:16           ` Viresh Kumar
  2013-03-26 17:29             ` [PATCH v2.2] dw_dmac: remove unnecessary ENODEV check Andy Shevchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Viresh Kumar @ 2013-03-26 17:16 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Vinod Koul, Arnd Bergmann, linux-kernel, spear-devel,
	Lars-Peter Clausen

On 26 March 2013 22:42, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Nowadays, besides removal of the -ENODEV checking, it makes probe
> function looks tidier.

Removal of -ENODEV is okay but am not sure if it makes code good :)

This is unnecessary abstraction for just calling a single routine. If that
part was bigger, i would have agreed but to me this wrapper is just
adding abstraction and nothing more.

--
viresh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2.2] dw_dmac: remove unnecessary ENODEV check
  2013-03-26 17:16           ` Viresh Kumar
@ 2013-03-26 17:29             ` Andy Shevchenko
  2013-03-26 17:31               ` Viresh Kumar
  0 siblings, 1 reply; 19+ messages in thread
From: Andy Shevchenko @ 2013-03-26 17:29 UTC (permalink / raw)
  To: Vinod Koul, Arnd Bergmann, Viresh Kumar, linux-kernel,
	spear-devel, Lars-Peter Clausen
  Cc: Andy Shevchenko

If CONFIG_OF is not set the of_node of the device will always be NULL.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw_dmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 274fd7d..736cffa 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1846,7 +1846,7 @@ static int dw_probe(struct platform_device *pdev)
 	if (pdev->dev.of_node) {
 		err = of_dma_controller_register(pdev->dev.of_node,
 						 dw_dma_of_xlate, dw);
-		if (err && err != -ENODEV)
+		if (err)
 			dev_err(&pdev->dev,
 				"could not register of_dma_controller\n");
 	}
-- 
1.8.2.rc0.22.gb3600c3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v2.2] dw_dmac: remove unnecessary ENODEV check
  2013-03-26 17:29             ` [PATCH v2.2] dw_dmac: remove unnecessary ENODEV check Andy Shevchenko
@ 2013-03-26 17:31               ` Viresh Kumar
  2013-03-26 18:15                 ` Arnd Bergmann
  0 siblings, 1 reply; 19+ messages in thread
From: Viresh Kumar @ 2013-03-26 17:31 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Vinod Koul, Arnd Bergmann, linux-kernel, spear-devel,
	Lars-Peter Clausen

On 26 March 2013 22:59, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> If CONFIG_OF is not set the of_node of the device will always be NULL.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/dma/dw_dmac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index 274fd7d..736cffa 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -1846,7 +1846,7 @@ static int dw_probe(struct platform_device *pdev)
>         if (pdev->dev.of_node) {
>                 err = of_dma_controller_register(pdev->dev.of_node,
>                                                  dw_dma_of_xlate, dw);
> -               if (err && err != -ENODEV)
> +               if (err)
>                         dev_err(&pdev->dev,
>                                 "could not register of_dma_controller\n");

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2.2] dw_dmac: remove unnecessary ENODEV check
  2013-03-26 17:31               ` Viresh Kumar
@ 2013-03-26 18:15                 ` Arnd Bergmann
  0 siblings, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2013-03-26 18:15 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Andy Shevchenko, Vinod Koul, linux-kernel, spear-devel,
	Lars-Peter Clausen

On Tuesday 26 March 2013, Viresh Kumar wrote:
> 
> On 26 March 2013 22:59, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > If CONFIG_OF is not set the of_node of the device will always be NULL.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  drivers/dma/dw_dmac.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> > index 274fd7d..736cffa 100644
> > --- a/drivers/dma/dw_dmac.c
> > +++ b/drivers/dma/dw_dmac.c
> > @@ -1846,7 +1846,7 @@ static int dw_probe(struct platform_device *pdev)
> >         if (pdev->dev.of_node) {
> >                 err = of_dma_controller_register(pdev->dev.of_node,
> >                                                  dw_dma_of_xlate, dw);
> > -               if (err && err != -ENODEV)
> > +               if (err)
> >                         dev_err(&pdev->dev,
> >                                 "could not register of_dma_controller\n");
> 
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 0/4] dw_dmac: cleanup for DT usage
  2013-03-26 14:53 [PATCH v2 0/4] dw_dmac: cleanup for DT usage Andy Shevchenko
                   ` (3 preceding siblings ...)
  2013-03-26 14:53 ` [PATCH v2 4/4] dmaengine: dw_dmac: simplify master selection Andy Shevchenko
@ 2013-04-01 17:55 ` Vinod Koul
  4 siblings, 0 replies; 19+ messages in thread
From: Vinod Koul @ 2013-04-01 17:55 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Arnd Bergmann, Viresh Kumar, linux-kernel, spear-devel

On Tue, Mar 26, 2013 at 04:53:53PM +0200, Andy Shevchenko wrote:
> It includes few cleanups when used with DT. Patch 4/4 is a modified version of
> the [1].
Applied 1, 2, 4 & 2.2

Thanks
~Vinod
> 
> [1] http://www.spinics.net/lists/arm-kernel/msg225366.html
> 
> Since v1:
>  - address Arnd's comments
>  - apply Acks I got from Viresh
> 
> Andy Shevchenko (3):
>   dw_dmac: fix style of the comments
>   dw_dmac: rename DT related methods to reflect their belonging
>   dw_dmac: make wrapper on of_dma_controller_register()
> 
> Arnd Bergmann (1):
>   dmaengine: dw_dmac: simplify master selection
> 
>  drivers/dma/dw_dmac.c      | 145 +++++++++++++++++++++------------------------
>  drivers/dma/dw_dmac_regs.h |   5 +-
>  2 files changed, 71 insertions(+), 79 deletions(-)
> 
> -- 
> 1.8.2.rc0.22.gb3600c3
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2013-04-01 18:23 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-26 14:53 [PATCH v2 0/4] dw_dmac: cleanup for DT usage Andy Shevchenko
2013-03-26 14:53 ` [PATCH v2 1/4] dw_dmac: fix style of the comments Andy Shevchenko
2013-03-26 15:01   ` Arnd Bergmann
2013-03-26 14:53 ` [PATCH v2 2/4] dw_dmac: rename DT related methods to reflect their belonging Andy Shevchenko
2013-03-26 15:02   ` Arnd Bergmann
2013-03-26 14:53 ` [PATCH v2 3/4] dw_dmac: make wrapper on of_dma_controller_register() Andy Shevchenko
2013-03-26 15:01   ` Arnd Bergmann
2013-03-26 15:04   ` Lars-Peter Clausen
2013-03-26 16:59     ` Andy Shevchenko
2013-03-26 17:04     ` [PATCH v2.1] " Andy Shevchenko
2013-03-26 17:07       ` Viresh Kumar
2013-03-26 17:12         ` Andy Shevchenko
2013-03-26 17:16           ` Viresh Kumar
2013-03-26 17:29             ` [PATCH v2.2] dw_dmac: remove unnecessary ENODEV check Andy Shevchenko
2013-03-26 17:31               ` Viresh Kumar
2013-03-26 18:15                 ` Arnd Bergmann
2013-03-26 14:53 ` [PATCH v2 4/4] dmaengine: dw_dmac: simplify master selection Andy Shevchenko
2013-03-26 15:02   ` Arnd Bergmann
2013-04-01 17:55 ` [PATCH v2 0/4] dw_dmac: cleanup for DT usage Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox