diff mbox

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

Message ID 1420713497-29212-1-git-send-email-haokexin@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Kevin Hao Jan. 8, 2015, 10:38 a.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>
---

v2: set the residue_granularity explicitly as suggested by Lars-Peter.

 drivers/dma/fsldma.c | 5 +++++
 drivers/dma/fsldma.h | 4 ++++
 2 files changed, 9 insertions(+)

Comments

Vinod Koul Jan. 13, 2015, 6:28 p.m. UTC | #1
On Thu, Jan 08, 2015 at 06:38:16PM +0800, Kevin Hao wrote:
> 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:

Applied both,

Thanks
diff mbox

Patch

diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index b891079a166d..6856c8a916ab 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1372,6 +1372,11 @@  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);
+	fdev->common.residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR;
+
 	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;