1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Renesas SuperH DMA Engine support
5 * Copyright (C) 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
6 * Copyright (C) 2009 Renesas Solutions, Inc. All rights reserved.
12 #include <linux/sh_dma.h>
13 #include <linux/shdma-base.h>
14 #include <linux/dmaengine.h>
15 #include <linux/interrupt.h>
16 #include <linux/list.h>
18 #define SH_DMAE_MAX_CHANNELS 20
19 #define SH_DMAE_TCR_MAX 0x00FFFFFF /* 16MB */
24 struct shdma_chan shdma_chan
;
25 const struct sh_dmae_slave_config
*config
; /* Slave DMA configuration */
26 int xmit_shift
; /* log_2(bytes_per_xfer) */
28 char dev_id
[16]; /* unique name per DMAC of channel */
30 dma_addr_t slave_addr
;
33 struct sh_dmae_device
{
34 struct shdma_dev shdma_dev
;
35 struct sh_dmae_chan
*chan
[SH_DMAE_MAX_CHANNELS
];
36 const struct sh_dmae_pdata
*pdata
;
37 struct list_head node
;
38 void __iomem
*chan_reg
;
40 unsigned int chcr_offset
;
45 u32 sar
; /* SAR / source address */
46 u32 dar
; /* DAR / destination address */
47 u32 tcr
; /* TCR / transfer count */
51 struct sh_dmae_regs hw
;
52 struct shdma_desc shdma_desc
;
55 #define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, shdma_chan)
56 #define to_sh_desc(lh) container_of(lh, struct sh_desc, node)
57 #define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx)
58 #define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\
59 struct sh_dmae_device, shdma_dev.dma_dev)
61 #endif /* __DMA_SHDMA_H */