diff mbox

[1/2] dmaengine: fsldma: declare slave capabilities for the generic code

Message ID 1420635431-3291-1-git-send-email-haokexin@gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Kevin Hao Jan. 7, 2015, 12:57 p.m. UTC
Since commit ecc19d17868b ("dmaengine: Add a warning for drivers not
using the generic slave caps retrieval"), the dma drivers are required
to fill the caps infos in order to support generic slaves caps
retrieval. Otherwise we will get a warning like this:
  WARNING: at drivers/dma/dmaengine.c:830
  Modules linked in:
  CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W       3.19.0-rc2-next-20150106-dirty #271
  task: c0000001f70a0000 ti: c0000001f7044000 task.ti: c0000001f7044000
  NIP: c00000000032b238 LR: c00000000032b234 CTR: c00000000001d258
  REGS: c0000001f7047330 TRAP: 0700   Tainted: G        W        (3.19.0-rc2-next-20150106-dirty)
  MSR: 0000000080029000 <CE,EE,ME>  CR: 24adbe22  XER: 20000000
  SOFTE: 1
  GPR00: c00000000032b234 c0000001f70475b0 c0000000009b4848 0000000000000040
  GPR04: 0000000000000001 0000000000000001 0000000000000000 000000000000000f
  GPR08: 0000000000000000 c000000000902988 c000000000902988 00000000000052c8
  GPR12: 0000000024adbe22 c00000000fff4000 c000000000002038 0000000000000000
  GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
  GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
  GPR24: 0000000000000000 0000000000000000 c000000000972dc8 c0000000007e6fd0
  GPR28: c0000001f76d1d30 c0000001f76d1c10 c0000001f76d1c00 0000000000000000
  NIP [c00000000032b238] .dma_async_device_register+0x3f8/0x5b8
  LR [c00000000032b234] .dma_async_device_register+0x3f4/0x5b8
  Call Trace:
  [c0000001f70475b0] [c00000000032b234] .dma_async_device_register+0x3f4/0x5b8 (unreliable)
  [c0000001f70476a0] [c00000000032ca78] .fsldma_of_probe+0x298/0x438
  [c0000001f7047750] [c00000000037080c] .platform_drv_probe+0x50/0x9c
  [c0000001f70477d0] [c00000000036e74c] .really_probe+0xa4/0x29c
  [c0000001f7047870] [c00000000036eae4] .__driver_attach+0x100/0x104
  [c0000001f7047900] [c00000000036c1f0] .bus_for_each_dev+0x84/0xe4
  [c0000001f70479a0] [c00000000036e164] .driver_attach+0x24/0x38
  [c0000001f7047a10] [c00000000036dcc8] .bus_add_driver+0x1c8/0x2ac
  [c0000001f7047ab0] [c00000000036f14c] .driver_register+0x8c/0x158
  [c0000001f7047b30] [c0000000003707a8] .__platform_driver_register+0x6c/0x80
  [c0000001f7047ba0] [c000000000898a3c] .fsldma_init+0x2c/0x40
  [c0000001f7047c10] [c000000000001818] .do_one_initcall+0xb8/0x234
  [c0000001f7047d00] [c000000000878e2c] .kernel_init_freeable+0x188/0x268
  [c0000001f7047db0] [c000000000002054] .kernel_init+0x1c/0xfc8
  [c0000001f7047e30] [c000000000000884] .ret_from_kernel_thread+0x58/0xd4
  Instruction dump:
  7fb9f840 3bffffe0 409effac 7f54d378 48000060 813d0050 2f890000 40befdd0
  3c62ffe3 38632450 482f0aa9 60000000 <0fe00000> 4bfffdb8 7f03c378 482ed465

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 drivers/dma/fsldma.c | 4 ++++
 drivers/dma/fsldma.h | 4 ++++
 2 files changed, 8 insertions(+)

Comments

Lars-Peter Clausen Jan. 7, 2015, 2:23 p.m. UTC | #1
On 01/07/2015 01:57 PM, Kevin Hao wrote:
[...]
> +	fdev->common.src_addr_widths = FSL_DMA_BUSWIDTHS;
> +	fdev->common.dst_addr_widths = FSL_DMA_BUSWIDTHS;
> +	fdev->common.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);

Please also set residue_granularity.


--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kevin Hao Jan. 8, 2015, 5:28 a.m. UTC | #2
On Wed, Jan 07, 2015 at 03:23:24PM +0100, Lars-Peter Clausen wrote:
> On 01/07/2015 01:57 PM, Kevin Hao wrote:
> [...]
> >+	fdev->common.src_addr_widths = FSL_DMA_BUSWIDTHS;
> >+	fdev->common.dst_addr_widths = FSL_DMA_BUSWIDTHS;
> >+	fdev->common.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
> 
> Please also set residue_granularity.

In the current fsldma driver, the residue reporting is not supported. So using
the default setting (DMA_RESIDUE_GRANULARITY_DESCRIPTOR) seems right to me.
Why do we still need to explicitly set residue_granularity? Did I miss
something?

Thanks,
Kevin
Lars-Peter Clausen Jan. 8, 2015, 9:58 a.m. UTC | #3
On 01/08/2015 06:28 AM, Kevin Hao wrote:
> On Wed, Jan 07, 2015 at 03:23:24PM +0100, Lars-Peter Clausen wrote:
>> On 01/07/2015 01:57 PM, Kevin Hao wrote:
>> [...]
>>> +	fdev->common.src_addr_widths = FSL_DMA_BUSWIDTHS;
>>> +	fdev->common.dst_addr_widths = FSL_DMA_BUSWIDTHS;
>>> +	fdev->common.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
>>
>> Please also set residue_granularity.
>
> In the current fsldma driver, the residue reporting is not supported. So using
> the default setting (DMA_RESIDUE_GRANULARITY_DESCRIPTOR) seems right to me.
> Why do we still need to explicitly set residue_granularity? Did I miss
> something?

Setting it makes it explicit that this is the granularity that is supported 
by the driver and not simply has been overlooked setting the property.

--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kevin Hao Jan. 8, 2015, 10:18 a.m. UTC | #4
On Thu, Jan 08, 2015 at 10:58:39AM +0100, Lars-Peter Clausen wrote:
> On 01/08/2015 06:28 AM, Kevin Hao wrote:
> >On Wed, Jan 07, 2015 at 03:23:24PM +0100, Lars-Peter Clausen wrote:
> >>On 01/07/2015 01:57 PM, Kevin Hao wrote:
> >>[...]
> >>>+	fdev->common.src_addr_widths = FSL_DMA_BUSWIDTHS;
> >>>+	fdev->common.dst_addr_widths = FSL_DMA_BUSWIDTHS;
> >>>+	fdev->common.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
> >>
> >>Please also set residue_granularity.
> >
> >In the current fsldma driver, the residue reporting is not supported. So using
> >the default setting (DMA_RESIDUE_GRANULARITY_DESCRIPTOR) seems right to me.
> >Why do we still need to explicitly set residue_granularity? Did I miss
> >something?
> 
> Setting it makes it explicit that this is the granularity that is supported
> by the driver and not simply has been overlooked setting the property.

OK, I will set the residue_granularity to DMA_RESIDUE_GRANULARITY_DESCRIPTOR
explicitly. The v2 coming soon.

Thanks,
Kevin
diff mbox

Patch

diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index b891079a166d..93db1c3d87a6 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1372,6 +1372,10 @@  static int fsldma_of_probe(struct platform_device *op)
 	fdev->common.device_terminate_all = fsl_dma_device_terminate_all;
 	fdev->common.dev = &op->dev;
 
+	fdev->common.src_addr_widths = FSL_DMA_BUSWIDTHS;
+	fdev->common.dst_addr_widths = FSL_DMA_BUSWIDTHS;
+	fdev->common.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
+
 	dma_set_mask(&(op->dev), DMA_BIT_MASK(36));
 
 	platform_set_drvdata(op, fdev);
diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h
index 239c20c84382..31bffccdcc75 100644
--- a/drivers/dma/fsldma.h
+++ b/drivers/dma/fsldma.h
@@ -83,6 +83,10 @@ 
 #define FSL_DMA_DGSR_EOSI	0x02
 #define FSL_DMA_DGSR_EOLSI	0x01
 
+#define FSL_DMA_BUSWIDTHS	(BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \
+				BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \
+				BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) | \
+				BIT(DMA_SLAVE_BUSWIDTH_8_BYTES))
 typedef u64 __bitwise v64;
 typedef u32 __bitwise v32;