/*
 * include/asm-arm/arch-cxd4115/regs-dmac.h
 *
 * CXD4115 DMAC registers
 *
 * Copyright 2007,2008,2009 Sony Corporation
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * 
 */
#ifndef __REGS_DMAC_H__
#define __REGS_DMAC_H__

/* global register */
#define DMACINTSTATUS   	(IO_ADDRESSP(CXD4115_DMAC0_BASE))
# define DMAC_VALIDBITMASK		0x000000ff /* 8ch */
#define DMACINTTCSTATUS   	(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x04)
#define DMACINTTCCLR   		(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x08)
#define DMACINTERRORSTATUS   	(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x0C)
#define DMACINTERRCLR   	(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x10)
#define DMACRAWINTTCSTATUS   	(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x14)
#define DMACRAWINTERRORSTATUS  	(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x18)
#define DMACENBLDCHNS   	(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x1C)
#define DMACSOFTBREQ   		(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x20)
#define DMACSOFTSREQ   		(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x24)
#define DMACSOFTLBREQ   	(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x28)
#define DMACSOFTLSREQ   	(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x2C)
#define DMACCONFIGRATION   	(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x30)
#define DMACSYNC   		(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x34)
#define DMACSREQMASK   		(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x38)

/* channel registers */
#define DMA_BASE_(x)		(IO_ADDRESSP(CXD4115_DMAC0_BASE)+0x100+((x)<<5))
#define DMACCSRCADDR_(x)	(DMA_BASE_(x)+0x00)
#define DMACCDESTADDR_(x)	(DMA_BASE_(x)+0x04)
#define DMACCLLI_(x)		(DMA_BASE_(x)+0x08)
#define DMACCCONTROL_(x)	(DMA_BASE_(x)+0x0C)
# define DMAC_TC_ENABLE		0x80000000 /* TC intr enable */
# define DMAC_TC_4096		/* max TC is 4096 */
#define DMACCCONFIGURATION_(x)	(DMA_BASE_(x)+0x10)
# define DMACCCONFIG_DESTDEV_SHIFT 6
# define DMACCCONFIG_SRCDEV_SHIFT  1
# define DMACCCONFIG_HALT	0x00040000
# define DMACCCONFIG_ACTIVE	0x00020000
# define DMACCCONFIG_ENABLE	0x00000001

#define DMA_MAX_CHANNELS	8
#define DMA_CH_TO_IRQ(x)	IRQ_DMAC0(x)
#define DMA_IRQ_TO_CH(x)	((x) - IRQ_DMAC0(0))

#define DMA0_REQID_UART0RX	0
#define DMA0_REQID_UART0TX	1
#define DMA0_REQID_UART1RX	2
#define DMA0_REQID_UART1TX	3
#define DMA0_REQID_ONA		4
#define DMA0_REQID_CML		5
#define DMA0_REQID_LDECWR	6
#define DMA0_REQID_LDECRD	7

#endif /* __REGS_DMAC_H__ */
