aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/sh/shdma.h
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-05-09 11:09:21 -0400
committerVinod Koul <vinod.koul@linux.intel.com>2012-07-12 23:43:08 -0400
commitce3a1ab74264b860450709e4bd0dcfc2d0bfc7f8 (patch)
tree445fdd53ae7775810d0b05ca90c392ee25367889 /drivers/dma/sh/shdma.h
parentb8373147ed3ca01a968d81f22688f2836a9aeb6b (diff)
dma: shdma: convert to the shdma base library
The shdma base library has originally been extracted from the shdma driver, which now can be converted to actually use it. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma/sh/shdma.h')
-rw-r--r--drivers/dma/sh/shdma.h44
1 files changed, 20 insertions, 24 deletions
diff --git a/drivers/dma/sh/shdma.h b/drivers/dma/sh/shdma.h
index 0b1d2c105f02..840e47d1c86c 100644
--- a/drivers/dma/sh/shdma.h
+++ b/drivers/dma/sh/shdma.h
@@ -13,42 +13,27 @@
13#ifndef __DMA_SHDMA_H 13#ifndef __DMA_SHDMA_H
14#define __DMA_SHDMA_H 14#define __DMA_SHDMA_H
15 15
16#include <linux/shdma-base.h>
16#include <linux/dmaengine.h> 17#include <linux/dmaengine.h>
17#include <linux/interrupt.h> 18#include <linux/interrupt.h>
18#include <linux/list.h> 19#include <linux/list.h>
19 20
20#define SH_DMAC_MAX_CHANNELS 20 21#define SH_DMAE_MAX_CHANNELS 20
21#define SH_DMA_SLAVE_NUMBER 256 22#define SH_DMAE_TCR_MAX 0x00FFFFFF /* 16MB */
22#define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */
23 23
24struct device; 24struct device;
25 25
26enum dmae_pm_state {
27 DMAE_PM_ESTABLISHED,
28 DMAE_PM_BUSY,
29 DMAE_PM_PENDING,
30};
31
32struct sh_dmae_chan { 26struct sh_dmae_chan {
33 spinlock_t desc_lock; /* Descriptor operation lock */ 27 struct shdma_chan shdma_chan;
34 struct list_head ld_queue; /* Link descriptors queue */
35 struct list_head ld_free; /* Link descriptors free */
36 struct dma_chan common; /* DMA common channel */
37 struct device *dev; /* Channel device */
38 struct tasklet_struct tasklet; /* Tasklet */
39 int descs_allocated; /* desc count */
40 int xmit_shift; /* log_2(bytes_per_xfer) */ 28 int xmit_shift; /* log_2(bytes_per_xfer) */
41 int irq;
42 int id; /* Raw id of this channel */
43 u32 __iomem *base; 29 u32 __iomem *base;
44 char dev_id[16]; /* unique name per DMAC of channel */ 30 char dev_id[16]; /* unique name per DMAC of channel */
45 int pm_error; 31 int pm_error;
46 enum dmae_pm_state pm_state;
47}; 32};
48 33
49struct sh_dmae_device { 34struct sh_dmae_device {
50 struct dma_device common; 35 struct shdma_dev shdma_dev;
51 struct sh_dmae_chan *chan[SH_DMAC_MAX_CHANNELS]; 36 struct sh_dmae_chan *chan[SH_DMAE_MAX_CHANNELS];
52 struct sh_dmae_pdata *pdata; 37 struct sh_dmae_pdata *pdata;
53 struct list_head node; 38 struct list_head node;
54 u32 __iomem *chan_reg; 39 u32 __iomem *chan_reg;
@@ -57,10 +42,21 @@ struct sh_dmae_device {
57 u32 chcr_ie_bit; 42 u32 chcr_ie_bit;
58}; 43};
59 44
60#define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, common) 45struct sh_dmae_regs {
46 u32 sar; /* SAR / source address */
47 u32 dar; /* DAR / destination address */
48 u32 tcr; /* TCR / transfer count */
49};
50
51struct sh_dmae_desc {
52 struct sh_dmae_regs hw;
53 struct shdma_desc shdma_desc;
54};
55
56#define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, shdma_chan)
61#define to_sh_desc(lh) container_of(lh, struct sh_desc, node) 57#define to_sh_desc(lh) container_of(lh, struct sh_desc, node)
62#define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx) 58#define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx)
63#define to_sh_dev(chan) container_of(chan->common.device,\ 59#define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\
64 struct sh_dmae_device, common) 60 struct sh_dmae_device, shdma_dev.dma_dev)
65 61
66#endif /* __DMA_SHDMA_H */ 62#endif /* __DMA_SHDMA_H */