* [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems)
@ 2016-04-27 11:15 Andy Shevchenko
2016-04-27 11:15 ` [PATCH v7 1/4] dmaengine: dw: platform: check nr_masters to be non-zero Andy Shevchenko
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Andy Shevchenko @ 2016-04-27 11:15 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 v6:
- leave old data_width property in the Documentation as deprecated
- add Acked-by tags
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 | 7 +-
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, 67 insertions(+), 76 deletions(-)
--
2.8.0.rc3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v7 1/4] dmaengine: dw: platform: check nr_masters to be non-zero
2016-04-27 11:15 [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
@ 2016-04-27 11:15 ` Andy Shevchenko
2016-04-27 11:15 ` [PATCH v7 2/4] dmaengine: dw: revisit data_width property Andy Shevchenko
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2016-04-27 11:15 UTC (permalink / raw)
To: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
Mark Brown, Vineet Gupta, Tejun Heo
Cc: Andy Shevchenko
The value of nr_masters 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.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
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] 8+ messages in thread
* [PATCH v7 2/4] dmaengine: dw: revisit data_width property
2016-04-27 11:15 [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
2016-04-27 11:15 ` [PATCH v7 1/4] dmaengine: dw: platform: check nr_masters to be non-zero Andy Shevchenko
@ 2016-04-27 11:15 ` Andy Shevchenko
2016-04-27 11:15 ` [PATCH v7 3/4] dmaengine: dw: keep entire platform data in struct dw_dma Andy Shevchenko
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2016-04-27 11:15 UTC (permalink / raw)
To: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
Mark Brown, Vineet Gupta, Tejun Heo
Cc: Andy Shevchenko
There several changes are done here:
- Convert the property to be in bytes
Besides that this is a common practice for such property, the use of a value
in bytes much more convenient than handling the encoded one.
- Rename data_width to data-width in the device tree bindings
The change leaves the support for the old format as well just in case someone
will use a newer kernel with an old device tree blob.
- While here, replace dwc_fast_ffs() by __ffs()
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
Documentation/devicetree/bindings/dma/snps-dma.txt | 7 +++-
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, 24 insertions(+), 38 deletions(-)
diff --git a/Documentation/devicetree/bindings/dma/snps-dma.txt b/Documentation/devicetree/bindings/dma/snps-dma.txt
index c99c1ff..0f55832 100644
--- a/Documentation/devicetree/bindings/dma/snps-dma.txt
+++ b/Documentation/devicetree/bindings/dma/snps-dma.txt
@@ -13,6 +13,11 @@ 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
+ (in bytes, power of 2)
+
+
+Deprecated properties:
- data_width: Maximum data width supported by hardware per AHB master
(0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
@@ -38,7 +43,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] 8+ messages in thread
* [PATCH v7 3/4] dmaengine: dw: keep entire platform data in struct dw_dma
2016-04-27 11:15 [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
2016-04-27 11:15 ` [PATCH v7 1/4] dmaengine: dw: platform: check nr_masters to be non-zero Andy Shevchenko
2016-04-27 11:15 ` [PATCH v7 2/4] dmaengine: dw: revisit data_width property Andy Shevchenko
@ 2016-04-27 11:15 ` Andy Shevchenko
2016-04-27 11:15 ` [PATCH v7 4/4] dmaengine: dw: pass platform data via struct dw_dma_chip Andy Shevchenko
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2016-04-27 11:15 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.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
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] 8+ messages in thread
* [PATCH v7 4/4] dmaengine: dw: pass platform data via struct dw_dma_chip
2016-04-27 11:15 [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
` (2 preceding siblings ...)
2016-04-27 11:15 ` [PATCH v7 3/4] dmaengine: dw: keep entire platform data in struct dw_dma Andy Shevchenko
@ 2016-04-27 11:15 ` Andy Shevchenko
2016-04-27 11:17 ` [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Viresh Kumar
2016-05-02 10:01 ` Vinod Koul
5 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2016-04-27 11:15 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 dw_dma_probe() anyway, thus we may use it to
pass a platform data as well.
While here, constify the source of the platform data.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
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] 8+ messages in thread
* Re: [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems)
2016-04-27 11:15 [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
` (3 preceding siblings ...)
2016-04-27 11:15 ` [PATCH v7 4/4] dmaengine: dw: pass platform data via struct dw_dma_chip Andy Shevchenko
@ 2016-04-27 11:17 ` Viresh Kumar
2016-05-02 10:01 ` Vinod Koul
5 siblings, 0 replies; 8+ messages in thread
From: Viresh Kumar @ 2016-04-27 11:17 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Viresh Kumar, Vinod Koul, linux-kernel, dmaengine, Rob Herring,
Mark Brown, Vineet Gupta, Tejun Heo
On 27-04-16, 14:15, Andy Shevchenko wrote:
> 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 v6:
> - leave old data_width property in the Documentation as deprecated
> - add Acked-by tags
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems)
2016-04-27 11:15 [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
` (4 preceding siblings ...)
2016-04-27 11:17 ` [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Viresh Kumar
@ 2016-05-02 10:01 ` Vinod Koul
2016-05-03 13:12 ` Andy Shevchenko
5 siblings, 1 reply; 8+ messages in thread
From: Vinod Koul @ 2016-05-02 10:01 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Viresh Kumar, linux-kernel, dmaengine, Rob Herring, Mark Brown,
Vineet Gupta, Tejun Heo
On Wed, Apr 27, 2016 at 02:15:36PM +0300, Andy Shevchenko wrote:
> 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.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems)
2016-05-02 10:01 ` Vinod Koul
@ 2016-05-03 13:12 ` Andy Shevchenko
0 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2016-05-03 13:12 UTC (permalink / raw)
To: Vinod Koul
Cc: Viresh Kumar, linux-kernel, dmaengine, Rob Herring, Mark Brown,
Vineet Gupta, Tejun Heo
On Mon, 2016-05-02 at 15:31 +0530, Vinod Koul wrote:
> On Wed, Apr 27, 2016 at 02:15:36PM +0300, Andy Shevchenko wrote:
> >
> > This patch series (v3: http://www.spinics.net/lists/kernel/msg221530
> > 3.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.
> Applied, thanks
Thanks!
What is the name of immutable branch / tag the other maintainers can
use? (I'm talking mostly about sata_dwc_460ex series)
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-05-03 13:12 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-27 11:15 [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Andy Shevchenko
2016-04-27 11:15 ` [PATCH v7 1/4] dmaengine: dw: platform: check nr_masters to be non-zero Andy Shevchenko
2016-04-27 11:15 ` [PATCH v7 2/4] dmaengine: dw: revisit data_width property Andy Shevchenko
2016-04-27 11:15 ` [PATCH v7 3/4] dmaengine: dw: keep entire platform data in struct dw_dma Andy Shevchenko
2016-04-27 11:15 ` [PATCH v7 4/4] dmaengine: dw: pass platform data via struct dw_dma_chip Andy Shevchenko
2016-04-27 11:17 ` [PATCH v7 0/4] Fixes / cleanups in dw_dmac (affects on few subsystems) Viresh Kumar
2016-05-02 10:01 ` Vinod Koul
2016-05-03 13:12 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox