18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Renesas SuperH DMA Engine support 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com> 68c2ecf20Sopenharmony_ci * Copyright (C) 2009 Renesas Solutions, Inc. All rights reserved. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#ifndef __DMA_SHDMA_H 108c2ecf20Sopenharmony_ci#define __DMA_SHDMA_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <linux/sh_dma.h> 138c2ecf20Sopenharmony_ci#include <linux/shdma-base.h> 148c2ecf20Sopenharmony_ci#include <linux/dmaengine.h> 158c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 168c2ecf20Sopenharmony_ci#include <linux/list.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define SH_DMAE_MAX_CHANNELS 20 198c2ecf20Sopenharmony_ci#define SH_DMAE_TCR_MAX 0x00FFFFFF /* 16MB */ 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_cistruct device; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_cistruct sh_dmae_chan { 248c2ecf20Sopenharmony_ci struct shdma_chan shdma_chan; 258c2ecf20Sopenharmony_ci const struct sh_dmae_slave_config *config; /* Slave DMA configuration */ 268c2ecf20Sopenharmony_ci int xmit_shift; /* log_2(bytes_per_xfer) */ 278c2ecf20Sopenharmony_ci void __iomem *base; 288c2ecf20Sopenharmony_ci char dev_id[16]; /* unique name per DMAC of channel */ 298c2ecf20Sopenharmony_ci int pm_error; 308c2ecf20Sopenharmony_ci dma_addr_t slave_addr; 318c2ecf20Sopenharmony_ci}; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cistruct sh_dmae_device { 348c2ecf20Sopenharmony_ci struct shdma_dev shdma_dev; 358c2ecf20Sopenharmony_ci struct sh_dmae_chan *chan[SH_DMAE_MAX_CHANNELS]; 368c2ecf20Sopenharmony_ci const struct sh_dmae_pdata *pdata; 378c2ecf20Sopenharmony_ci struct list_head node; 388c2ecf20Sopenharmony_ci void __iomem *chan_reg; 398c2ecf20Sopenharmony_ci void __iomem *dmars; 408c2ecf20Sopenharmony_ci unsigned int chcr_offset; 418c2ecf20Sopenharmony_ci u32 chcr_ie_bit; 428c2ecf20Sopenharmony_ci}; 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistruct sh_dmae_regs { 458c2ecf20Sopenharmony_ci u32 sar; /* SAR / source address */ 468c2ecf20Sopenharmony_ci u32 dar; /* DAR / destination address */ 478c2ecf20Sopenharmony_ci u32 tcr; /* TCR / transfer count */ 488c2ecf20Sopenharmony_ci}; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_cistruct sh_dmae_desc { 518c2ecf20Sopenharmony_ci struct sh_dmae_regs hw; 528c2ecf20Sopenharmony_ci struct shdma_desc shdma_desc; 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, shdma_chan) 568c2ecf20Sopenharmony_ci#define to_sh_desc(lh) container_of(lh, struct sh_desc, node) 578c2ecf20Sopenharmony_ci#define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx) 588c2ecf20Sopenharmony_ci#define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\ 598c2ecf20Sopenharmony_ci struct sh_dmae_device, shdma_dev.dma_dev) 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#endif /* __DMA_SHDMA_H */ 62