Commit cfefe997 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Paul Mundt

sh: implement DMA_SLAVE capability in SH dmaengine driver

Tested to work with a SIU ASoC driver on sh7722 (migor).
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 623b4ac4
...@@ -64,8 +64,10 @@ static int dmte_irq_map[] __maybe_unused = { ...@@ -64,8 +64,10 @@ static int dmte_irq_map[] __maybe_unused = {
#define ACK_L 0x00010000 #define ACK_L 0x00010000
#define DM_INC 0x00004000 #define DM_INC 0x00004000
#define DM_DEC 0x00008000 #define DM_DEC 0x00008000
#define DM_FIX 0x0000c000
#define SM_INC 0x00001000 #define SM_INC 0x00001000
#define SM_DEC 0x00002000 #define SM_DEC 0x00002000
#define SM_FIX 0x00003000
#define RS_IN 0x00000200 #define RS_IN 0x00000200
#define RS_OUT 0x00000300 #define RS_OUT 0x00000300
#define TS_BLK 0x00000040 #define TS_BLK 0x00000040
...@@ -125,8 +127,45 @@ static u32 dma_base_addr[] __maybe_unused = { ...@@ -125,8 +127,45 @@ static u32 dma_base_addr[] __maybe_unused = {
#define SHDMA_DMAOR1 (1 << 2) #define SHDMA_DMAOR1 (1 << 2)
#define SHDMA_DMAE1 (1 << 3) #define SHDMA_DMAE1 (1 << 3)
enum sh_dmae_slave_chan_id {
SHDMA_SLAVE_SCIF0_TX,
SHDMA_SLAVE_SCIF0_RX,
SHDMA_SLAVE_SCIF1_TX,
SHDMA_SLAVE_SCIF1_RX,
SHDMA_SLAVE_SCIF2_TX,
SHDMA_SLAVE_SCIF2_RX,
SHDMA_SLAVE_SCIF3_TX,
SHDMA_SLAVE_SCIF3_RX,
SHDMA_SLAVE_SCIF4_TX,
SHDMA_SLAVE_SCIF4_RX,
SHDMA_SLAVE_SCIF5_TX,
SHDMA_SLAVE_SCIF5_RX,
SHDMA_SLAVE_SIUA_TX,
SHDMA_SLAVE_SIUA_RX,
SHDMA_SLAVE_SIUB_TX,
SHDMA_SLAVE_SIUB_RX,
SHDMA_SLAVE_NUMBER, /* Must stay last */
};
struct sh_dmae_slave_config {
enum sh_dmae_slave_chan_id slave_id;
dma_addr_t addr;
u32 chcr;
char mid_rid;
};
struct sh_dmae_pdata { struct sh_dmae_pdata {
unsigned int mode; unsigned int mode;
struct sh_dmae_slave_config *config;
int config_num;
};
struct device;
struct sh_dmae_slave {
enum sh_dmae_slave_chan_id slave_id; /* Set by the platform */
struct device *dma_dev; /* Set by the platform */
struct sh_dmae_slave_config *config; /* Set by the driver */
}; };
#endif /* __DMA_SH_H */ #endif /* __DMA_SH_H */
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#define DMTE4_IRQ 76 #define DMTE4_IRQ 76
#define DMAE0_IRQ 78 /* DMA Error IRQ*/ #define DMAE0_IRQ 78 /* DMA Error IRQ*/
#define SH_DMAC_BASE0 0xFE008020 #define SH_DMAC_BASE0 0xFE008020
#define SH_DMARS_BASE 0xFE009000 #define SH_DMARS_BASE0 0xFE009000
#define CHCR_TS_LOW_MASK 0x00000018 #define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3 #define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0 #define CHCR_TS_HIGH_MASK 0
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#define DMTE4_IRQ 76 #define DMTE4_IRQ 76
#define DMAE0_IRQ 78 /* DMA Error IRQ*/ #define DMAE0_IRQ 78 /* DMA Error IRQ*/
#define SH_DMAC_BASE0 0xFE008020 #define SH_DMAC_BASE0 0xFE008020
#define SH_DMARS_BASE 0xFE009000 #define SH_DMARS_BASE0 0xFE009000
#define CHCR_TS_LOW_MASK 0x00000018 #define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3 #define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0x00300000 #define CHCR_TS_HIGH_MASK 0x00300000
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#define DMTE4_IRQ 44 #define DMTE4_IRQ 44
#define DMAE0_IRQ 38 #define DMAE0_IRQ 38
#define SH_DMAC_BASE0 0xFF608020 #define SH_DMAC_BASE0 0xFF608020
#define SH_DMARS_BASE 0xFF609000 #define SH_DMARS_BASE0 0xFF609000
#define CHCR_TS_LOW_MASK 0x00000018 #define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3 #define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0 #define CHCR_TS_HIGH_MASK 0
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#define DMAE1_IRQ 74 /* DMA Error IRQ*/ #define DMAE1_IRQ 74 /* DMA Error IRQ*/
#define SH_DMAC_BASE0 0xFE008020 #define SH_DMAC_BASE0 0xFE008020
#define SH_DMAC_BASE1 0xFDC08020 #define SH_DMAC_BASE1 0xFDC08020
#define SH_DMARS_BASE 0xFDC09000 #define SH_DMARS_BASE0 0xFDC09000
#define CHCR_TS_LOW_MASK 0x00000018 #define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3 #define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0 #define CHCR_TS_HIGH_MASK 0
...@@ -62,7 +62,8 @@ ...@@ -62,7 +62,8 @@
#define DMAE1_IRQ 74 /* DMA Error IRQ*/ #define DMAE1_IRQ 74 /* DMA Error IRQ*/
#define SH_DMAC_BASE0 0xFE008020 #define SH_DMAC_BASE0 0xFE008020
#define SH_DMAC_BASE1 0xFDC08020 #define SH_DMAC_BASE1 0xFDC08020
#define SH_DMARS_BASE 0xFDC09000 #define SH_DMARS_BASE0 0xFE009000
#define SH_DMARS_BASE1 0xFDC09000
#define CHCR_TS_LOW_MASK 0x00000018 #define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3 #define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0x00600000 #define CHCR_TS_HIGH_MASK 0x00600000
...@@ -78,7 +79,7 @@ ...@@ -78,7 +79,7 @@
#define DMAE0_IRQ 38 /* DMA Error IRQ */ #define DMAE0_IRQ 38 /* DMA Error IRQ */
#define SH_DMAC_BASE0 0xFC808020 #define SH_DMAC_BASE0 0xFC808020
#define SH_DMAC_BASE1 0xFC818020 #define SH_DMAC_BASE1 0xFC818020
#define SH_DMARS_BASE 0xFC809000 #define SH_DMARS_BASE0 0xFC809000
#define CHCR_TS_LOW_MASK 0x00000018 #define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3 #define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0 #define CHCR_TS_HIGH_MASK 0
...@@ -95,7 +96,7 @@ ...@@ -95,7 +96,7 @@
#define DMAE1_IRQ 58 /* DMA Error IRQ1 */ #define DMAE1_IRQ 58 /* DMA Error IRQ1 */
#define SH_DMAC_BASE0 0xFC808020 #define SH_DMAC_BASE0 0xFC808020
#define SH_DMAC_BASE1 0xFCC08020 #define SH_DMAC_BASE1 0xFCC08020
#define SH_DMARS_BASE 0xFC809000 #define SH_DMARS_BASE0 0xFC809000
#define CHCR_TS_LOW_MASK 0x00000018 #define CHCR_TS_LOW_MASK 0x00000018
#define CHCR_TS_LOW_SHIFT 3 #define CHCR_TS_LOW_SHIFT 3
#define CHCR_TS_HIGH_MASK 0 #define CHCR_TS_HIGH_MASK 0
......
This diff is collapsed.
...@@ -29,6 +29,7 @@ struct sh_desc { ...@@ -29,6 +29,7 @@ struct sh_desc {
struct sh_dmae_regs hw; struct sh_dmae_regs hw;
struct list_head node; struct list_head node;
struct dma_async_tx_descriptor async_tx; struct dma_async_tx_descriptor async_tx;
enum dma_data_direction direction;
dma_cookie_t cookie; dma_cookie_t cookie;
int chunks; int chunks;
int mark; int mark;
...@@ -45,13 +46,9 @@ struct sh_dmae_chan { ...@@ -45,13 +46,9 @@ struct sh_dmae_chan {
struct device *dev; /* Channel device */ struct device *dev; /* Channel device */
struct tasklet_struct tasklet; /* Tasklet */ struct tasklet_struct tasklet; /* Tasklet */
int descs_allocated; /* desc count */ int descs_allocated; /* desc count */
int xmit_shift; /* log_2(bytes_per_xfer) */
int id; /* Raw id of this channel */ int id; /* Raw id of this channel */
char dev_id[16]; /* unique name per DMAC of channel */ char dev_id[16]; /* unique name per DMAC of channel */
/* Set chcr */
int (*set_chcr)(struct sh_dmae_chan *sh_chan, u32 regs);
/* Set DMA resource */
int (*set_dmars)(struct sh_dmae_chan *sh_chan, u16 res);
}; };
struct sh_dmae_device { struct sh_dmae_device {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment