Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
[pandora-kernel.git] / arch / sh / include / asm / dmaengine.h
1 /*
2  * Header for the new SH dmaengine driver
3  *
4  * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 #ifndef ASM_DMAENGINE_H
11 #define ASM_DMAENGINE_H
12
13 #include <linux/dmaengine.h>
14 #include <linux/list.h>
15
16 #include <asm/dma-register.h>
17
18 #define SH_DMAC_MAX_CHANNELS    6
19
20 enum sh_dmae_slave_chan_id {
21         SHDMA_SLAVE_SCIF0_TX,
22         SHDMA_SLAVE_SCIF0_RX,
23         SHDMA_SLAVE_SCIF1_TX,
24         SHDMA_SLAVE_SCIF1_RX,
25         SHDMA_SLAVE_SCIF2_TX,
26         SHDMA_SLAVE_SCIF2_RX,
27         SHDMA_SLAVE_SCIF3_TX,
28         SHDMA_SLAVE_SCIF3_RX,
29         SHDMA_SLAVE_SCIF4_TX,
30         SHDMA_SLAVE_SCIF4_RX,
31         SHDMA_SLAVE_SCIF5_TX,
32         SHDMA_SLAVE_SCIF5_RX,
33         SHDMA_SLAVE_SIUA_TX,
34         SHDMA_SLAVE_SIUA_RX,
35         SHDMA_SLAVE_SIUB_TX,
36         SHDMA_SLAVE_SIUB_RX,
37         SHDMA_SLAVE_NUMBER,     /* Must stay last */
38 };
39
40 struct sh_dmae_slave_config {
41         enum sh_dmae_slave_chan_id      slave_id;
42         dma_addr_t                      addr;
43         u32                             chcr;
44         char                            mid_rid;
45 };
46
47 struct sh_dmae_channel {
48         unsigned int    offset;
49         unsigned int    dmars;
50         unsigned int    dmars_bit;
51 };
52
53 struct sh_dmae_pdata {
54         struct sh_dmae_slave_config *slave;
55         int slave_num;
56         struct sh_dmae_channel *channel;
57         int channel_num;
58         unsigned int ts_low_shift;
59         unsigned int ts_low_mask;
60         unsigned int ts_high_shift;
61         unsigned int ts_high_mask;
62         unsigned int *ts_shift;
63         int ts_shift_num;
64         u16 dmaor_init;
65 };
66
67 struct device;
68
69 /* Used by slave DMA clients to request DMA to/from a specific peripheral */
70 struct sh_dmae_slave {
71         enum sh_dmae_slave_chan_id      slave_id; /* Set by the platform */
72         struct device                   *dma_dev; /* Set by the platform */
73         struct sh_dmae_slave_config     *config;  /* Set by the driver */
74 };
75
76 struct sh_dmae_regs {
77         u32 sar; /* SAR / source address */
78         u32 dar; /* DAR / destination address */
79         u32 tcr; /* TCR / transfer count */
80 };
81
82 struct sh_desc {
83         struct sh_dmae_regs hw;
84         struct list_head node;
85         struct dma_async_tx_descriptor async_tx;
86         enum dma_data_direction direction;
87         dma_cookie_t cookie;
88         size_t partial;
89         int chunks;
90         int mark;
91 };
92
93 #endif