All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems)
       [not found] <Cc:Andy Shevchenko <andriy.shevchenko@linux.intel.com>
@ 2016-04-25 12:35 ` Andy Shevchenko
  2016-04-25 12:35   ` [PATCH v6 1/4] dmaengine: dw: platform: check nr_masters to be non-zero Andy Shevchenko
                     ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Andy Shevchenko @ 2016-04-25 12:35 UTC (permalink / raw)
  To: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
	Mark Brown, Vineet Gupta, Tejun Heo
  Cc: Andy Shevchenko

This patch series (v3: http://www.spinics.net/lists/kernel/msg2215303.html)
contains a number of mostly minor fixes and cleanups for the DW DMA driver. A
couple of them affect the DT binding so these may need to be updated to
maintain compatibility (old format is still supported though). The rest should
be relatively straight-forward.

This version has been tested on the following bare metal platforms:
- ATNGW100 (avr32 based platform) with dmatest
- Sam460ex (powerpc 44x based platform) with SATA
- Intel Braswell with UART
- Intel Galileo (Intel Quark based platform) with UART

(SATA driver and Intel Galileo UART support are based on this series and just
 published recently for a review)

Vinod, there are few patch sets developed on top of this one, so, the idea is
to keep this in an immuutable branch / tag.

Changes since v5:
- fixed an issue found by kbuildbot

Changes since v4:
- send proper set of patches
- add changelog

Changes since v3:
- add patch 1 to check value of dma-masters property
- drop the upstreamed patches
- update patch 2 to keep an array for data-width property as well

Changes since v2:
- add patch 1 to fix master selection which was broken for long time
- remove "use field-by-field initialization" patch since like Mans metioned in
  has mostly no value and even might increase error prone
- rebase on top of recent linux-next
- wide testing on several platforms

Changes since v1:
- zeroing struct dw_dma_slave before use
- fall back to old data_width property if data-width is not found
- append tags for few patches
- correct title of cover letter
- rebase on top of recent linux-next

Andy Shevchenko (4):
  dmaengine: dw: platform: check nr_masters to be non-zero
  dmaengine: dw: revisit data_width property
  dmaengine: dw: keep entire platform data in struct dw_dma
  dmaengine: dw: pass platform data via struct dw_dma_chip

 Documentation/devicetree/bindings/dma/snps-dma.txt |  6 +-
 arch/arc/boot/dts/abilis_tb10x.dtsi                |  2 +-
 arch/arm/boot/dts/spear13xx.dtsi                   |  4 +-
 drivers/ata/sata_dwc_460ex.c                       |  2 +-
 drivers/dma/dw/core.c                              | 75 ++++++++--------------
 drivers/dma/dw/pci.c                               |  5 +-
 drivers/dma/dw/platform.c                          | 32 +++++----
 drivers/dma/dw/regs.h                              |  5 +-
 include/linux/dma/dw.h                             |  5 +-
 include/linux/platform_data/dma-dw.h               |  4 +-
 sound/soc/intel/common/sst-firmware.c              |  2 +-
 11 files changed, 64 insertions(+), 78 deletions(-)

-- 
2.8.0.rc3

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

* [PATCH v6 1/4] dmaengine: dw: platform: check nr_masters to be non-zero
  2016-04-25 12:35 ` [PATCH v6 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
@ 2016-04-25 12:35   ` Andy Shevchenko
  2016-04-27  6:44     ` Viresh Kumar
  2016-04-25 12:35   ` [PATCH v6 2/4] dmaengine: dw: revisit data_width property Andy Shevchenko
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2016-04-25 12:35 UTC (permalink / raw)
  To: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
	Mark Brown, Vineet Gupta, Tejun Heo
  Cc: Andy Shevchenko

The nr_masters value equal to 0 is invalid since this DMA controller has to
have at least one master.

Check this before we proceed with the rest of properties.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw/platform.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index 23616c5..e65ebe5 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -103,6 +103,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	struct dw_dma_platform_data *pdata;
 	u32 tmp, arr[DW_DMA_MAX_NR_MASTERS];
+	u32 nr_masters;
 	u32 nr_channels;
 
 	if (!np) {
@@ -110,6 +111,11 @@ dw_dma_parse_dt(struct platform_device *pdev)
 		return NULL;
 	}
 
+	if (of_property_read_u32(np, "dma-masters", &nr_masters))
+		return NULL;
+	if (nr_masters < 1 || nr_masters > DW_DMA_MAX_NR_MASTERS)
+		return NULL;
+
 	if (of_property_read_u32(np, "dma-channels", &nr_channels))
 		return NULL;
 
@@ -117,6 +123,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
 	if (!pdata)
 		return NULL;
 
+	pdata->nr_masters = nr_masters;
 	pdata->nr_channels = nr_channels;
 
 	if (of_property_read_bool(np, "is_private"))
@@ -131,17 +138,10 @@ dw_dma_parse_dt(struct platform_device *pdev)
 	if (!of_property_read_u32(np, "block_size", &tmp))
 		pdata->block_size = tmp;
 
-	if (!of_property_read_u32(np, "dma-masters", &tmp)) {
-		if (tmp > DW_DMA_MAX_NR_MASTERS)
-			return NULL;
-
-		pdata->nr_masters = tmp;
-	}
-
-	if (!of_property_read_u32_array(np, "data_width", arr,
-				pdata->nr_masters))
-		for (tmp = 0; tmp < pdata->nr_masters; tmp++)
+	if (!of_property_read_u32_array(np, "data_width", arr, nr_masters)) {
+		for (tmp = 0; tmp < nr_masters; tmp++)
 			pdata->data_width[tmp] = arr[tmp];
+	}
 
 	return pdata;
 }
-- 
2.8.0.rc3

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

* [PATCH v6 2/4] dmaengine: dw: revisit data_width property
  2016-04-25 12:35 ` [PATCH v6 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
  2016-04-25 12:35   ` [PATCH v6 1/4] dmaengine: dw: platform: check nr_masters to be non-zero Andy Shevchenko
@ 2016-04-25 12:35   ` Andy Shevchenko
  2016-04-27  6:43     ` Viresh Kumar
  2016-04-25 12:35   ` [PATCH v6 3/4] dmaengine: dw: keep entire platform data in struct dw_dma Andy Shevchenko
  2016-04-25 12:35   ` [PATCH v6 4/4] dmaengine: dw: pass platform data via struct dw_dma_chip Andy Shevchenko
  3 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2016-04-25 12:35 UTC (permalink / raw)
  To: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
	Mark Brown, Vineet Gupta, Tejun Heo
  Cc: Andy Shevchenko

There are several changes are done here:

- Convert the property to be in bytes

Besides this is common practice for such property the use of a value in bytes
much more convenient than handling the encoded value.

- Rename data_width to data-width in the device tree bindings

- While here, replace dwc_fast_ffs() by __ffs()

The change leaves the support for old format as well just in case someone will
use a newer kernel with an old device tree blob.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 Documentation/devicetree/bindings/dma/snps-dma.txt |  6 ++--
 arch/arc/boot/dts/abilis_tb10x.dtsi                |  2 +-
 arch/arm/boot/dts/spear13xx.dtsi                   |  4 +--
 drivers/dma/dw/core.c                              | 42 ++++++----------------
 drivers/dma/dw/platform.c                          |  5 ++-
 include/linux/platform_data/dma-dw.h               |  2 +-
 6 files changed, 21 insertions(+), 40 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/snps-dma.txt b/Documentation/devicetree/bindings/dma/snps-dma.txt
index c99c1ff..544b9b9 100644
--- a/Documentation/devicetree/bindings/dma/snps-dma.txt
+++ b/Documentation/devicetree/bindings/dma/snps-dma.txt
@@ -13,8 +13,8 @@ Required properties:
 - chan_priority: priority of channels. 0 (default): increase from chan 0->n, 1:
   increase from chan n->0
 - block_size: Maximum block size supported by the controller
-- data_width: Maximum data width supported by hardware per AHB master
-  (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
+- data-width: Maximum data width supported by hardware per AHB master
+  (in bytes, power of 2)
 
 
 Optional properties:
@@ -38,7 +38,7 @@ Example:
 		chan_allocation_order = <1>;
 		chan_priority = <1>;
 		block_size = <0xfff>;
-		data_width = <3 3>;
+		data-width = <8 8>;
 	};
 
 DMA clients connected to the Designware DMA controller must use the format
diff --git a/arch/arc/boot/dts/abilis_tb10x.dtsi b/arch/arc/boot/dts/abilis_tb10x.dtsi
index 663671f2..de53f5c 100644
--- a/arch/arc/boot/dts/abilis_tb10x.dtsi
+++ b/arch/arc/boot/dts/abilis_tb10x.dtsi
@@ -126,7 +126,7 @@
 			chan_allocation_order = <0>;
 			chan_priority = <1>;
 			block_size = <0x7ff>;
-			data_width = <2>;
+			data-width = <4>;
 			clocks = <&ahb_clk>;
 			clock-names = "hclk";
 		};
diff --git a/arch/arm/boot/dts/spear13xx.dtsi b/arch/arm/boot/dts/spear13xx.dtsi
index 14594ce..449acf0 100644
--- a/arch/arm/boot/dts/spear13xx.dtsi
+++ b/arch/arm/boot/dts/spear13xx.dtsi
@@ -117,7 +117,7 @@
 			chan_priority = <1>;
 			block_size = <0xfff>;
 			dma-masters = <2>;
-			data_width = <3 3>;
+			data-width = <8 8>;
 		};
 
 		dma@eb000000 {
@@ -133,7 +133,7 @@
 			chan_allocation_order = <1>;
 			chan_priority = <1>;
 			block_size = <0xfff>;
-			data_width = <3 3>;
+			data-width = <8 8>;
 		};
 
 		fsmc: flash@b0000000 {
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index 78522dc..992da25 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -162,21 +162,6 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
 
 /*----------------------------------------------------------------------*/
 
-static inline unsigned int dwc_fast_ffs(unsigned long long v)
-{
-	/*
-	 * We can be a lot more clever here, but this should take care
-	 * of the most common optimization.
-	 */
-	if (!(v & 7))
-		return 3;
-	else if (!(v & 3))
-		return 2;
-	else if (!(v & 1))
-		return 1;
-	return 0;
-}
-
 static inline void dwc_dump_chan_regs(struct dw_dma_chan *dwc)
 {
 	dev_err(chan2dev(&dwc->chan),
@@ -677,11 +662,12 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 	struct dw_desc		*prev;
 	size_t			xfer_count;
 	size_t			offset;
+	u8			m_master = dwc->m_master;
 	unsigned int		src_width;
 	unsigned int		dst_width;
-	unsigned int		data_width;
+	unsigned int		data_width = dw->data_width[m_master];
 	u32			ctllo;
-	u8			lms = DWC_LLP_LMS(dwc->m_master);
+	u8			lms = DWC_LLP_LMS(m_master);
 
 	dev_vdbg(chan2dev(chan),
 			"%s: d%pad s%pad l0x%zx f0x%lx\n", __func__,
@@ -694,10 +680,7 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 
 	dwc->direction = DMA_MEM_TO_MEM;
 
-	data_width = dw->data_width[dwc->m_master];
-
-	src_width = dst_width = min_t(unsigned int, data_width,
-				      dwc_fast_ffs(src | dest | len));
+	src_width = dst_width = __ffs(data_width | src | dest | len);
 
 	ctllo = DWC_DEFAULT_CTLLO(chan)
 			| DWC_CTLL_DST_WIDTH(dst_width)
@@ -757,11 +740,12 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 	struct dw_desc		*prev;
 	struct dw_desc		*first;
 	u32			ctllo;
-	u8			lms = DWC_LLP_LMS(dwc->m_master);
+	u8			m_master = dwc->m_master;
+	u8			lms = DWC_LLP_LMS(m_master);
 	dma_addr_t		reg;
 	unsigned int		reg_width;
 	unsigned int		mem_width;
-	unsigned int		data_width;
+	unsigned int		data_width = dw->data_width[m_master];
 	unsigned int		i;
 	struct scatterlist	*sg;
 	size_t			total_len = 0;
@@ -787,8 +771,6 @@ 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 = dw->data_width[dwc->m_master];
-
 		for_each_sg(sgl, sg, sg_len, i) {
 			struct dw_desc	*desc;
 			u32		len, dlen, mem;
@@ -796,8 +778,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 			mem = sg_dma_address(sg);
 			len = sg_dma_len(sg);
 
-			mem_width = min_t(unsigned int,
-					  data_width, dwc_fast_ffs(mem | len));
+			mem_width = __ffs(data_width | mem | len);
 
 slave_sg_todev_fill_desc:
 			desc = dwc_desc_get(dwc);
@@ -843,8 +824,6 @@ 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 = dw->data_width[dwc->m_master];
-
 		for_each_sg(sgl, sg, sg_len, i) {
 			struct dw_desc	*desc;
 			u32		len, dlen, mem;
@@ -852,8 +831,7 @@ slave_sg_todev_fill_desc:
 			mem = sg_dma_address(sg);
 			len = sg_dma_len(sg);
 
-			mem_width = min_t(unsigned int,
-					  data_width, dwc_fast_ffs(mem | len));
+			mem_width = __ffs(data_width | mem | len);
 
 slave_sg_fromdev_fill_desc:
 			desc = dwc_desc_get(dwc);
@@ -1500,7 +1478,7 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 		pdata->nr_masters = (dw_params >> DW_PARAMS_NR_MASTER & 3) + 1;
 		for (i = 0; i < pdata->nr_masters; i++) {
 			pdata->data_width[i] =
-				(dw_params >> DW_PARAMS_DATA_WIDTH(i) & 3) + 2;
+				4 << (dw_params >> DW_PARAMS_DATA_WIDTH(i) & 3);
 		}
 		max_blk_size = dma_readl(dw, MAX_BLK_SIZE);
 
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index e65ebe5..2420fb7 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -138,9 +138,12 @@ dw_dma_parse_dt(struct platform_device *pdev)
 	if (!of_property_read_u32(np, "block_size", &tmp))
 		pdata->block_size = tmp;
 
-	if (!of_property_read_u32_array(np, "data_width", arr, nr_masters)) {
+	if (!of_property_read_u32_array(np, "data-width", arr, nr_masters)) {
 		for (tmp = 0; tmp < nr_masters; tmp++)
 			pdata->data_width[tmp] = arr[tmp];
+	} else if (!of_property_read_u32_array(np, "data_width", arr, nr_masters)) {
+		for (tmp = 0; tmp < nr_masters; tmp++)
+			pdata->data_width[tmp] = BIT(arr[tmp] & 0x07);
 	}
 
 	return pdata;
diff --git a/include/linux/platform_data/dma-dw.h b/include/linux/platform_data/dma-dw.h
index b881b97..ad76811 100644
--- a/include/linux/platform_data/dma-dw.h
+++ b/include/linux/platform_data/dma-dw.h
@@ -43,7 +43,7 @@ struct dw_dma_slave {
  * @block_size: Maximum block size supported by the controller
  * @nr_masters: Number of AHB masters supported by the controller
  * @data_width: Maximum data width supported by hardware per AHB master
- *		(0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
+ *		(in bytes, power of 2)
  */
 struct dw_dma_platform_data {
 	unsigned int	nr_channels;
-- 
2.8.0.rc3

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

* [PATCH v6 3/4] dmaengine: dw: keep entire platform data in struct dw_dma
  2016-04-25 12:35 ` [PATCH v6 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
  2016-04-25 12:35   ` [PATCH v6 1/4] dmaengine: dw: platform: check nr_masters to be non-zero Andy Shevchenko
  2016-04-25 12:35   ` [PATCH v6 2/4] dmaengine: dw: revisit data_width property Andy Shevchenko
@ 2016-04-25 12:35   ` Andy Shevchenko
  2016-04-27  6:46     ` Viresh Kumar
  2016-04-25 12:35   ` [PATCH v6 4/4] dmaengine: dw: pass platform data via struct dw_dma_chip Andy Shevchenko
  3 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2016-04-25 12:35 UTC (permalink / raw)
  To: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
	Mark Brown, Vineet Gupta, Tejun Heo
  Cc: Andy Shevchenko

Keep the entire platform data in the struct dw_dma.
It makes the driver a bit cleaner.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw/core.c                | 30 +++++++++++++++---------------
 drivers/dma/dw/platform.c            |  4 ++--
 drivers/dma/dw/regs.h                |  5 ++---
 include/linux/platform_data/dma-dw.h |  2 +-
 4 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index 992da25..30843a1 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -665,7 +665,7 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 	u8			m_master = dwc->m_master;
 	unsigned int		src_width;
 	unsigned int		dst_width;
-	unsigned int		data_width = dw->data_width[m_master];
+	unsigned int		data_width = dw->pdata->data_width[m_master];
 	u32			ctllo;
 	u8			lms = DWC_LLP_LMS(m_master);
 
@@ -745,7 +745,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 	dma_addr_t		reg;
 	unsigned int		reg_width;
 	unsigned int		mem_width;
-	unsigned int		data_width = dw->data_width[m_master];
+	unsigned int		data_width = dw->pdata->data_width[m_master];
 	unsigned int		i;
 	struct scatterlist	*sg;
 	size_t			total_len = 0;
@@ -1444,7 +1444,6 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 	struct dw_dma		*dw;
 	bool			autocfg = false;
 	unsigned int		dw_params;
-	unsigned int		max_blk_size = 0;
 	unsigned int		i;
 	int			err;
 
@@ -1452,6 +1451,10 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 	if (!dw)
 		return -ENOMEM;
 
+	dw->pdata = devm_kzalloc(chip->dev, sizeof(*dw->pdata), GFP_KERNEL);
+	if (!dw->pdata)
+		return -ENOMEM;
+
 	dw->regs = chip->regs;
 	chip->dw = dw;
 
@@ -1467,11 +1470,8 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 			goto err_pdata;
 		}
 
-		pdata = devm_kzalloc(chip->dev, sizeof(*pdata), GFP_KERNEL);
-		if (!pdata) {
-			err = -ENOMEM;
-			goto err_pdata;
-		}
+		/* Reassign the platform data pointer */
+		pdata = dw->pdata;
 
 		/* Get hardware configuration parameters */
 		pdata->nr_channels = (dw_params >> DW_PARAMS_NR_CHAN & 7) + 1;
@@ -1480,7 +1480,7 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 			pdata->data_width[i] =
 				4 << (dw_params >> DW_PARAMS_DATA_WIDTH(i) & 3);
 		}
-		max_blk_size = dma_readl(dw, MAX_BLK_SIZE);
+		pdata->block_size = dma_readl(dw, MAX_BLK_SIZE);
 
 		/* Fill platform data with the default values */
 		pdata->is_private = true;
@@ -1490,6 +1490,11 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 	} else if (pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS) {
 		err = -EINVAL;
 		goto err_pdata;
+	} else {
+		memcpy(dw->pdata, pdata, sizeof(*dw->pdata));
+
+		/* Reassign the platform data pointer */
+		pdata = dw->pdata;
 	}
 
 	dw->chan = devm_kcalloc(chip->dev, pdata->nr_channels, sizeof(*dw->chan),
@@ -1499,11 +1504,6 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 		goto err_pdata;
 	}
 
-	/* Get hardware configuration parameters */
-	dw->nr_masters = pdata->nr_masters;
-	for (i = 0; i < dw->nr_masters; i++)
-		dw->data_width[i] = pdata->data_width[i];
-
 	/* Calculate all channel mask before DMA setup */
 	dw->all_chan_mask = (1 << pdata->nr_channels) - 1;
 
@@ -1570,7 +1570,7 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 			 * up to 0x0a for 4095.
 			 */
 			dwc->block_size =
-				(4 << ((max_blk_size >> 4 * i) & 0xf)) - 1;
+				(4 << ((pdata->block_size >> 4 * i) & 0xf)) - 1;
 			dwc->nollp =
 				(dwc_params >> DWC_PARAMS_MBLK_EN & 0x1) == 0;
 		} else {
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index 2420fb7..0a49011 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -47,8 +47,8 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
 
 	if (WARN_ON(slave.src_id >= DW_DMA_MAX_NR_REQUESTS ||
 		    slave.dst_id >= DW_DMA_MAX_NR_REQUESTS ||
-		    slave.m_master >= dw->nr_masters ||
-		    slave.p_master >= dw->nr_masters))
+		    slave.m_master >= dw->pdata->nr_masters ||
+		    slave.p_master >= dw->pdata->nr_masters))
 		return NULL;
 
 	dma_cap_zero(cap);
diff --git a/drivers/dma/dw/regs.h b/drivers/dma/dw/regs.h
index 0ab02eb..4b7bd78 100644
--- a/drivers/dma/dw/regs.h
+++ b/drivers/dma/dw/regs.h
@@ -281,9 +281,8 @@ struct dw_dma {
 	u8			all_chan_mask;
 	u8			in_use;
 
-	/* hardware configuration */
-	unsigned char		nr_masters;
-	unsigned char		data_width[DW_DMA_MAX_NR_MASTERS];
+	/* platform data */
+	struct dw_dma_platform_data	*pdata;
 };
 
 static inline struct dw_dma_regs __iomem *__dw_regs(struct dw_dma *dw)
diff --git a/include/linux/platform_data/dma-dw.h b/include/linux/platform_data/dma-dw.h
index ad76811..d15d8ba 100644
--- a/include/linux/platform_data/dma-dw.h
+++ b/include/linux/platform_data/dma-dw.h
@@ -55,7 +55,7 @@ struct dw_dma_platform_data {
 #define CHAN_PRIORITY_ASCENDING		0	/* chan0 highest */
 #define CHAN_PRIORITY_DESCENDING	1	/* chan7 highest */
 	unsigned char	chan_priority;
-	unsigned short	block_size;
+	unsigned int	block_size;
 	unsigned char	nr_masters;
 	unsigned char	data_width[DW_DMA_MAX_NR_MASTERS];
 };
-- 
2.8.0.rc3

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

* [PATCH v6 4/4] dmaengine: dw: pass platform data via struct dw_dma_chip
  2016-04-25 12:35 ` [PATCH v6 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
                     ` (2 preceding siblings ...)
  2016-04-25 12:35   ` [PATCH v6 3/4] dmaengine: dw: keep entire platform data in struct dw_dma Andy Shevchenko
@ 2016-04-25 12:35   ` Andy Shevchenko
  2016-04-27  6:47     ` Viresh Kumar
  3 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2016-04-25 12:35 UTC (permalink / raw)
  To: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
	Mark Brown, Vineet Gupta, Tejun Heo
  Cc: Andy Shevchenko

We pass struct dw_dma_chip to the dw_dma_probe() anyway, thus we may use it to
pass platform data as well.

While here, constify the source of platform data.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/ata/sata_dwc_460ex.c          | 2 +-
 drivers/dma/dw/core.c                 | 9 +++++----
 drivers/dma/dw/pci.c                  | 5 +++--
 drivers/dma/dw/platform.c             | 5 +++--
 include/linux/dma/dw.h                | 5 ++++-
 sound/soc/intel/common/sst-firmware.c | 2 +-
 6 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 80bdcab..2cb6f7e 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1248,7 +1248,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
 	hsdev->dma->dev = &ofdev->dev;
 
 	/* Initialize AHB DMAC */
-	err = dw_dma_probe(hsdev->dma, NULL);
+	err = dw_dma_probe(hsdev->dma);
 	if (err)
 		goto error_dma_iomap;
 
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index 30843a1..edf053f 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -1439,8 +1439,9 @@ EXPORT_SYMBOL(dw_dma_cyclic_free);
 
 /*----------------------------------------------------------------------*/
 
-int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
+int dw_dma_probe(struct dw_dma_chip *chip)
 {
+	struct dw_dma_platform_data *pdata;
 	struct dw_dma		*dw;
 	bool			autocfg = false;
 	unsigned int		dw_params;
@@ -1460,7 +1461,7 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 
 	pm_runtime_get_sync(chip->dev);
 
-	if (!pdata) {
+	if (!chip->pdata) {
 		dw_params = dma_readl(dw, DW_PARAMS);
 		dev_dbg(chip->dev, "DW_PARAMS: 0x%08x\n", dw_params);
 
@@ -1487,11 +1488,11 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 		pdata->is_memcpy = true;
 		pdata->chan_allocation_order = CHAN_ALLOCATION_ASCENDING;
 		pdata->chan_priority = CHAN_PRIORITY_ASCENDING;
-	} else if (pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS) {
+	} else if (chip->pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS) {
 		err = -EINVAL;
 		goto err_pdata;
 	} else {
-		memcpy(dw->pdata, pdata, sizeof(*dw->pdata));
+		memcpy(dw->pdata, chip->pdata, sizeof(*dw->pdata));
 
 		/* Reassign the platform data pointer */
 		pdata = dw->pdata;
diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c
index 358f968..0ae6c3b 100644
--- a/drivers/dma/dw/pci.c
+++ b/drivers/dma/dw/pci.c
@@ -17,8 +17,8 @@
 
 static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
 {
+	const struct dw_dma_platform_data *pdata = (void *)pid->driver_data;
 	struct dw_dma_chip *chip;
-	struct dw_dma_platform_data *pdata = (void *)pid->driver_data;
 	int ret;
 
 	ret = pcim_enable_device(pdev);
@@ -49,8 +49,9 @@ static int dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
 	chip->dev = &pdev->dev;
 	chip->regs = pcim_iomap_table(pdev)[0];
 	chip->irq = pdev->irq;
+	chip->pdata = pdata;
 
-	ret = dw_dma_probe(chip, pdata);
+	ret = dw_dma_probe(chip);
 	if (ret)
 		return ret;
 
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index 0a49011..5bda0eb 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -161,7 +161,7 @@ static int dw_probe(struct platform_device *pdev)
 	struct dw_dma_chip *chip;
 	struct device *dev = &pdev->dev;
 	struct resource *mem;
-	struct dw_dma_platform_data *pdata;
+	const struct dw_dma_platform_data *pdata;
 	int err;
 
 	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
@@ -186,6 +186,7 @@ static int dw_probe(struct platform_device *pdev)
 		pdata = dw_dma_parse_dt(pdev);
 
 	chip->dev = dev;
+	chip->pdata = pdata;
 
 	chip->clk = devm_clk_get(chip->dev, "hclk");
 	if (IS_ERR(chip->clk))
@@ -196,7 +197,7 @@ static int dw_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(&pdev->dev);
 
-	err = dw_dma_probe(chip, pdata);
+	err = dw_dma_probe(chip);
 	if (err)
 		goto err_dw_dma_probe;
 
diff --git a/include/linux/dma/dw.h b/include/linux/dma/dw.h
index 7145644..f2e538a 100644
--- a/include/linux/dma/dw.h
+++ b/include/linux/dma/dw.h
@@ -27,6 +27,7 @@ struct dw_dma;
  * @regs:		memory mapped I/O space
  * @clk:		hclk clock
  * @dw:			struct dw_dma that is filed by dw_dma_probe()
+ * @pdata:		pointer to platform data
  */
 struct dw_dma_chip {
 	struct device	*dev;
@@ -34,10 +35,12 @@ struct dw_dma_chip {
 	void __iomem	*regs;
 	struct clk	*clk;
 	struct dw_dma	*dw;
+
+	const struct dw_dma_platform_data	*pdata;
 };
 
 /* Export to the platform drivers */
-int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata);
+int dw_dma_probe(struct dw_dma_chip *chip);
 int dw_dma_remove(struct dw_dma_chip *chip);
 
 /* DMA API extensions */
diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c
index ef4881e..2599352 100644
--- a/sound/soc/intel/common/sst-firmware.c
+++ b/sound/soc/intel/common/sst-firmware.c
@@ -203,7 +203,7 @@ static struct dw_dma_chip *dw_probe(struct device *dev, struct resource *mem,
 
 	chip->dev = dev;
 
-	err = dw_dma_probe(chip, NULL);
+	err = dw_dma_probe(chip);
 	if (err)
 		return ERR_PTR(err);
 
-- 
2.8.0.rc3

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

* Re: [PATCH v6 2/4] dmaengine: dw: revisit data_width property
  2016-04-25 12:35   ` [PATCH v6 2/4] dmaengine: dw: revisit data_width property Andy Shevchenko
@ 2016-04-27  6:43     ` Viresh Kumar
  2016-04-27  8:12       ` Vinod Koul
  2016-04-27  8:25       ` Andy Shevchenko
  0 siblings, 2 replies; 13+ messages in thread
From: Viresh Kumar @ 2016-04-27  6:43 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
	Mark Brown, Vineet Gupta, Tejun Heo

On 25-04-16, 15:35, Andy Shevchenko wrote:
> There are several changes are done here:
> 
> - Convert the property to be in bytes
> 
> Besides this is common practice for such property the use of a value in bytes
> much more convenient than handling the encoded value.
> 
> - Rename data_width to data-width in the device tree bindings
> 
> - While here, replace dwc_fast_ffs() by __ffs()
> 
> The change leaves the support for old format as well just in case someone will
> use a newer kernel with an old device tree blob.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  Documentation/devicetree/bindings/dma/snps-dma.txt |  6 ++--
>  arch/arc/boot/dts/abilis_tb10x.dtsi                |  2 +-
>  arch/arm/boot/dts/spear13xx.dtsi                   |  4 +--
>  drivers/dma/dw/core.c                              | 42 ++++++----------------
>  drivers/dma/dw/platform.c                          |  5 ++-
>  include/linux/platform_data/dma-dw.h               |  2 +-
>  6 files changed, 21 insertions(+), 40 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dma/snps-dma.txt b/Documentation/devicetree/bindings/dma/snps-dma.txt
> index c99c1ff..544b9b9 100644
> --- a/Documentation/devicetree/bindings/dma/snps-dma.txt
> +++ b/Documentation/devicetree/bindings/dma/snps-dma.txt
> @@ -13,8 +13,8 @@ Required properties:
>  - chan_priority: priority of channels. 0 (default): increase from chan 0->n, 1:
>    increase from chan n->0
>  - block_size: Maximum block size supported by the controller
> -- data_width: Maximum data width supported by hardware per AHB master
> -  (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
> +- data-width: Maximum data width supported by hardware per AHB master
> +  (in bytes, power of 2)
>  
>  
>  Optional properties:
> @@ -38,7 +38,7 @@ Example:
>  		chan_allocation_order = <1>;
>  		chan_priority = <1>;
>  		block_size = <0xfff>;
> -		data_width = <3 3>;
> +		data-width = <8 8>;
>  	};

You broke backward compatibility with earlier DTs.

What's backward compatibility ?

Consider that the DT from an earlier version of kernel is part of the bootrom of
a SoC. Now that bootrom should work just fine with any new kernel version. i.e.
old DT + new kernels should always work.

-- 
viresh

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

* Re: [PATCH v6 1/4] dmaengine: dw: platform: check nr_masters to be non-zero
  2016-04-25 12:35   ` [PATCH v6 1/4] dmaengine: dw: platform: check nr_masters to be non-zero Andy Shevchenko
@ 2016-04-27  6:44     ` Viresh Kumar
  0 siblings, 0 replies; 13+ messages in thread
From: Viresh Kumar @ 2016-04-27  6:44 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
	Mark Brown, Vineet Gupta, Tejun Heo

On 25-04-16, 15:35, Andy Shevchenko wrote:
> The nr_masters value equal to 0 is invalid since this DMA controller has to
> have at least one master.
> 
> Check this before we proceed with the rest of properties.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/dma/dw/platform.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)

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

-- 
viresh

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

* Re: [PATCH v6 3/4] dmaengine: dw: keep entire platform data in struct dw_dma
  2016-04-25 12:35   ` [PATCH v6 3/4] dmaengine: dw: keep entire platform data in struct dw_dma Andy Shevchenko
@ 2016-04-27  6:46     ` Viresh Kumar
  0 siblings, 0 replies; 13+ messages in thread
From: Viresh Kumar @ 2016-04-27  6:46 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
	Mark Brown, Vineet Gupta, Tejun Heo

On 25-04-16, 15:35, Andy Shevchenko wrote:
> Keep the entire platform data in the struct dw_dma.
> It makes the driver a bit cleaner.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/dma/dw/core.c                | 30 +++++++++++++++---------------
>  drivers/dma/dw/platform.c            |  4 ++--
>  drivers/dma/dw/regs.h                |  5 ++---
>  include/linux/platform_data/dma-dw.h |  2 +-
>  4 files changed, 20 insertions(+), 21 deletions(-)

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

-- 
viresh

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

* Re: [PATCH v6 4/4] dmaengine: dw: pass platform data via struct dw_dma_chip
  2016-04-25 12:35   ` [PATCH v6 4/4] dmaengine: dw: pass platform data via struct dw_dma_chip Andy Shevchenko
@ 2016-04-27  6:47     ` Viresh Kumar
  0 siblings, 0 replies; 13+ messages in thread
From: Viresh Kumar @ 2016-04-27  6:47 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
	Mark Brown, Vineet Gupta, Tejun Heo

On 25-04-16, 15:35, Andy Shevchenko wrote:
> We pass struct dw_dma_chip to the dw_dma_probe() anyway, thus we may use it to
> pass platform data as well.
> 
> While here, constify the source of platform data.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/ata/sata_dwc_460ex.c          | 2 +-
>  drivers/dma/dw/core.c                 | 9 +++++----
>  drivers/dma/dw/pci.c                  | 5 +++--
>  drivers/dma/dw/platform.c             | 5 +++--
>  include/linux/dma/dw.h                | 5 ++++-
>  sound/soc/intel/common/sst-firmware.c | 2 +-
>  6 files changed, 17 insertions(+), 11 deletions(-)

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

-- 
viresh

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

* Re: [PATCH v6 2/4] dmaengine: dw: revisit data_width property
  2016-04-27  6:43     ` Viresh Kumar
@ 2016-04-27  8:12       ` Vinod Koul
  2016-04-27  8:25       ` Andy Shevchenko
  1 sibling, 0 replies; 13+ messages in thread
From: Vinod Koul @ 2016-04-27  8:12 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Andy Shevchenko, Viresh Kumar, linux-kernel, dmaengine,
	Rob Herring, Mark Brown, Vineet Gupta, Tejun Heo

On Wed, Apr 27, 2016 at 12:13:17PM +0530, Viresh Kumar wrote:
> On 25-04-16, 15:35, Andy Shevchenko wrote:
> > There are several changes are done here:
> > 
> > - Convert the property to be in bytes
> > 
> > Besides this is common practice for such property the use of a value in bytes
> > much more convenient than handling the encoded value.
> > 
> > - Rename data_width to data-width in the device tree bindings
> > 
> > - While here, replace dwc_fast_ffs() by __ffs()
> > 
> > The change leaves the support for old format as well just in case someone will
> > use a newer kernel with an old device tree blob.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  Documentation/devicetree/bindings/dma/snps-dma.txt |  6 ++--
> >  arch/arc/boot/dts/abilis_tb10x.dtsi                |  2 +-
> >  arch/arm/boot/dts/spear13xx.dtsi                   |  4 +--
> >  drivers/dma/dw/core.c                              | 42 ++++++----------------
> >  drivers/dma/dw/platform.c                          |  5 ++-
> >  include/linux/platform_data/dma-dw.h               |  2 +-
> >  6 files changed, 21 insertions(+), 40 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/dma/snps-dma.txt b/Documentation/devicetree/bindings/dma/snps-dma.txt
> > index c99c1ff..544b9b9 100644
> > --- a/Documentation/devicetree/bindings/dma/snps-dma.txt
> > +++ b/Documentation/devicetree/bindings/dma/snps-dma.txt
> > @@ -13,8 +13,8 @@ Required properties:
> >  - chan_priority: priority of channels. 0 (default): increase from chan 0->n, 1:
> >    increase from chan n->0
> >  - block_size: Maximum block size supported by the controller
> > -- data_width: Maximum data width supported by hardware per AHB master
> > -  (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
> > +- data-width: Maximum data width supported by hardware per AHB master
> > +  (in bytes, power of 2)
> >  
> >  
> >  Optional properties:
> > @@ -38,7 +38,7 @@ Example:
> >  		chan_allocation_order = <1>;
> >  		chan_priority = <1>;
> >  		block_size = <0xfff>;
> > -		data_width = <3 3>;
> > +		data-width = <8 8>;
> >  	};
> 
> You broke backward compatibility with earlier DTs.
> 
> What's backward compatibility ?
> 
> Consider that the DT from an earlier version of kernel is part of the bootrom of
> a SoC. Now that bootrom should work just fine with any new kernel version. i.e.
> old DT + new kernels should always work.

And this is not fixed yet!.

-- 
~Vinod

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

* Re: [PATCH v6 2/4] dmaengine: dw: revisit data_width property
  2016-04-27  6:43     ` Viresh Kumar
  2016-04-27  8:12       ` Vinod Koul
@ 2016-04-27  8:25       ` Andy Shevchenko
  2016-04-27  8:30         ` Viresh Kumar
  1 sibling, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2016-04-27  8:25 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Andy Shevchenko, Viresh Kumar, Vinod Koul, linux-kernel,
	dmaengine, Rob Herring, Mark Brown, Vineet Gupta, Tejun Heo

On Wed, Apr 27, 2016 at 9:43 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 25-04-16, 15:35, Andy Shevchenko wrote:
>> There are several changes are done here:
>>
>> - Convert the property to be in bytes
>>
>> Besides this is common practice for such property the use of a value in bytes
>> much more convenient than handling the encoded value.
>>
>> - Rename data_width to data-width in the device tree bindings
>>
>> - While here, replace dwc_fast_ffs() by __ffs()
>>
>> The change leaves the support for old format as well just in case someone will
>> use a newer kernel with an old device tree blob.
>>
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>> ---
>>  Documentation/devicetree/bindings/dma/snps-dma.txt |  6 ++--
>>  arch/arc/boot/dts/abilis_tb10x.dtsi                |  2 +-
>>  arch/arm/boot/dts/spear13xx.dtsi                   |  4 +--
>>  drivers/dma/dw/core.c                              | 42 ++++++----------------
>>  drivers/dma/dw/platform.c                          |  5 ++-
>>  include/linux/platform_data/dma-dw.h               |  2 +-
>>  6 files changed, 21 insertions(+), 40 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/dma/snps-dma.txt b/Documentation/devicetree/bindings/dma/snps-dma.txt
>> index c99c1ff..544b9b9 100644
>> --- a/Documentation/devicetree/bindings/dma/snps-dma.txt
>> +++ b/Documentation/devicetree/bindings/dma/snps-dma.txt
>> @@ -13,8 +13,8 @@ Required properties:
>>  - chan_priority: priority of channels. 0 (default): increase from chan 0->n, 1:
>>    increase from chan n->0
>>  - block_size: Maximum block size supported by the controller
>> -- data_width: Maximum data width supported by hardware per AHB master
>> -  (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
>> +- data-width: Maximum data width supported by hardware per AHB master
>> +  (in bytes, power of 2)
>>
>>
>>  Optional properties:
>> @@ -38,7 +38,7 @@ Example:
>>               chan_allocation_order = <1>;
>>               chan_priority = <1>;
>>               block_size = <0xfff>;
>> -             data_width = <3 3>;
>> +             data-width = <8 8>;
>>       };
>
> You broke backward compatibility with earlier DTs.

How?

>
> What's backward compatibility ?
>
> Consider that the DT from an earlier version of kernel is part of the bootrom of
> a SoC. Now that bootrom should work just fine with any new kernel version. i.e.
> old DT + new kernels should always work.

Yes, the property name is slightly different as meaning.

If we find data-width property driver will use it, otherwise it takes
old name and converts variable to be in bytes in the driver.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v6 2/4] dmaengine: dw: revisit data_width property
  2016-04-27  8:25       ` Andy Shevchenko
@ 2016-04-27  8:30         ` Viresh Kumar
  2016-04-27  8:39           ` Andy Shevchenko
  0 siblings, 1 reply; 13+ messages in thread
From: Viresh Kumar @ 2016-04-27  8:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andy Shevchenko, Viresh Kumar, Vinod Koul, linux-kernel,
	dmaengine, Rob Herring, Mark Brown, Vineet Gupta, Tejun Heo

On 27-04-16, 11:25, Andy Shevchenko wrote:
> On Wed, Apr 27, 2016 at 9:43 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > On 25-04-16, 15:35, Andy Shevchenko wrote:
> >> There are several changes are done here:
> >>
> >> - Convert the property to be in bytes
> >>
> >> Besides this is common practice for such property the use of a value in bytes
> >> much more convenient than handling the encoded value.
> >>
> >> - Rename data_width to data-width in the device tree bindings
> >>
> >> - While here, replace dwc_fast_ffs() by __ffs()
> >>
> >> The change leaves the support for old format as well just in case someone will
> >> use a newer kernel with an old device tree blob.
> >>
> >> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >> ---
> >>  Documentation/devicetree/bindings/dma/snps-dma.txt |  6 ++--
> >>  arch/arc/boot/dts/abilis_tb10x.dtsi                |  2 +-
> >>  arch/arm/boot/dts/spear13xx.dtsi                   |  4 +--
> >>  drivers/dma/dw/core.c                              | 42 ++++++----------------
> >>  drivers/dma/dw/platform.c                          |  5 ++-
> >>  include/linux/platform_data/dma-dw.h               |  2 +-
> >>  6 files changed, 21 insertions(+), 40 deletions(-)
> >>
> >> diff --git a/Documentation/devicetree/bindings/dma/snps-dma.txt b/Documentation/devicetree/bindings/dma/snps-dma.txt
> >> index c99c1ff..544b9b9 100644
> >> --- a/Documentation/devicetree/bindings/dma/snps-dma.txt
> >> +++ b/Documentation/devicetree/bindings/dma/snps-dma.txt
> >> @@ -13,8 +13,8 @@ Required properties:
> >>  - chan_priority: priority of channels. 0 (default): increase from chan 0->n, 1:
> >>    increase from chan n->0
> >>  - block_size: Maximum block size supported by the controller
> >> -- data_width: Maximum data width supported by hardware per AHB master
> >> -  (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
> >> +- data-width: Maximum data width supported by hardware per AHB master
> >> +  (in bytes, power of 2)
> >>
> >>
> >>  Optional properties:
> >> @@ -38,7 +38,7 @@ Example:
> >>               chan_allocation_order = <1>;
> >>               chan_priority = <1>;
> >>               block_size = <0xfff>;
> >> -             data_width = <3 3>;
> >> +             data-width = <8 8>;
> >>       };
> >
> > You broke backward compatibility with earlier DTs.
> 
> How?
> 
> >
> > What's backward compatibility ?
> >
> > Consider that the DT from an earlier version of kernel is part of the bootrom of
> > a SoC. Now that bootrom should work just fine with any new kernel version. i.e.
> > old DT + new kernels should always work.
> 
> Yes, the property name is slightly different as meaning.
> 
> If we find data-width property driver will use it, otherwise it takes
> old name and converts variable to be in bytes in the driver.

Oh, I missed that you renamed the property and taking care of both the
properties now. Sorry about that. So, you didn't break them for sure :)

But, the DT documentation doesn't contain the old property now but the code
does. I think you are required to keep the bindings currently supported by the
kernel in there. You can mark them deprecated, but can't remove them.

-- 
viresh

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

* Re: [PATCH v6 2/4] dmaengine: dw: revisit data_width property
  2016-04-27  8:30         ` Viresh Kumar
@ 2016-04-27  8:39           ` Andy Shevchenko
  0 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2016-04-27  8:39 UTC (permalink / raw)
  To: Viresh Kumar, Andy Shevchenko
  Cc: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
	Mark Brown, Vineet Gupta, Tejun Heo

On Wed, 2016-04-27 at 14:00 +0530, Viresh Kumar wrote:
> On 27-04-16, 11:25, Andy Shevchenko wrote:
> > 
> > -- data_width: Maximum data width supported by hardware per AHB
> > > > master
> > > > -  (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
> > > > +- data-width: Maximum data width supported by hardware per AHB
> > > > master
> > > > +  (in bytes, power of 2)

> 
> But, the DT documentation doesn't contain the old property now but the
> code
> does. I think you are required to keep the bindings currently
> supported by the
> kernel in there. You can mark them deprecated, but can't remove them.

This point I take, indeed.

Will update series soon. Thanks for review.

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

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

end of thread, other threads:[~2016-04-27  8:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Cc:Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-04-25 12:35 ` [PATCH v6 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
2016-04-25 12:35   ` [PATCH v6 1/4] dmaengine: dw: platform: check nr_masters to be non-zero Andy Shevchenko
2016-04-27  6:44     ` Viresh Kumar
2016-04-25 12:35   ` [PATCH v6 2/4] dmaengine: dw: revisit data_width property Andy Shevchenko
2016-04-27  6:43     ` Viresh Kumar
2016-04-27  8:12       ` Vinod Koul
2016-04-27  8:25       ` Andy Shevchenko
2016-04-27  8:30         ` Viresh Kumar
2016-04-27  8:39           ` Andy Shevchenko
2016-04-25 12:35   ` [PATCH v6 3/4] dmaengine: dw: keep entire platform data in struct dw_dma Andy Shevchenko
2016-04-27  6:46     ` Viresh Kumar
2016-04-25 12:35   ` [PATCH v6 4/4] dmaengine: dw: pass platform data via struct dw_dma_chip Andy Shevchenko
2016-04-27  6:47     ` Viresh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.