18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright 2002 Integrated Device Technology, Inc.
48c2ecf20Sopenharmony_ci *		All rights reserved.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * DMA register definition.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Author : ryan.holmQVist@idt.com
98c2ecf20Sopenharmony_ci * Date	  : 20011005
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifndef __ASM_RC32434_DMA_H
138c2ecf20Sopenharmony_ci#define __ASM_RC32434_DMA_H
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <asm/mach-rc32434/rb.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define DMA0_BASE_ADDR			0x18040000
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/*
208c2ecf20Sopenharmony_ci * DMA descriptor (in physical memory).
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistruct dma_desc {
248c2ecf20Sopenharmony_ci	u32 control;			/* Control. use DMAD_* */
258c2ecf20Sopenharmony_ci	u32 ca;				/* Current Address. */
268c2ecf20Sopenharmony_ci	u32 devcs;			/* Device control and status. */
278c2ecf20Sopenharmony_ci	u32 link;			/* Next descriptor in chain. */
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define DMA_DESC_SIZ			sizeof(struct dma_desc)
318c2ecf20Sopenharmony_ci#define DMA_DESC_COUNT_BIT		0
328c2ecf20Sopenharmony_ci#define DMA_DESC_COUNT_MSK		0x0003ffff
338c2ecf20Sopenharmony_ci#define DMA_DESC_DS_BIT			20
348c2ecf20Sopenharmony_ci#define DMA_DESC_DS_MSK			0x00300000
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define DMA_DESC_DEV_CMD_BIT		22
378c2ecf20Sopenharmony_ci#define DMA_DESC_DEV_CMD_MSK		0x01c00000
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/* DMA command sizes */
408c2ecf20Sopenharmony_ci#define DMA_DESC_DEV_CMD_BYTE		0
418c2ecf20Sopenharmony_ci#define DMA_DESC_DEV_CMD_HLF_WD		1
428c2ecf20Sopenharmony_ci#define DMA_DESC_DEV_CMD_WORD		2
438c2ecf20Sopenharmony_ci#define DMA_DESC_DEV_CMD_2WORDS		3
448c2ecf20Sopenharmony_ci#define DMA_DESC_DEV_CMD_4WORDS		4
458c2ecf20Sopenharmony_ci#define DMA_DESC_DEV_CMD_6WORDS		5
468c2ecf20Sopenharmony_ci#define DMA_DESC_DEV_CMD_8WORDS		6
478c2ecf20Sopenharmony_ci#define DMA_DESC_DEV_CMD_16WORDS	7
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* DMA descriptors interrupts */
508c2ecf20Sopenharmony_ci#define DMA_DESC_COF			(1 << 25) /* Chain on finished */
518c2ecf20Sopenharmony_ci#define DMA_DESC_COD			(1 << 26) /* Chain on done */
528c2ecf20Sopenharmony_ci#define DMA_DESC_IOF			(1 << 27) /* Interrupt on finished */
538c2ecf20Sopenharmony_ci#define DMA_DESC_IOD			(1 << 28) /* Interrupt on done */
548c2ecf20Sopenharmony_ci#define DMA_DESC_TERM			(1 << 29) /* Terminated */
558c2ecf20Sopenharmony_ci#define DMA_DESC_DONE			(1 << 30) /* Done */
568c2ecf20Sopenharmony_ci#define DMA_DESC_FINI			(1 << 31) /* Finished */
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/*
598c2ecf20Sopenharmony_ci * DMA register (within Internal Register Map).
608c2ecf20Sopenharmony_ci */
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_cistruct dma_reg {
638c2ecf20Sopenharmony_ci	u32 dmac;		/* Control. */
648c2ecf20Sopenharmony_ci	u32 dmas;		/* Status. */
658c2ecf20Sopenharmony_ci	u32 dmasm;		/* Mask. */
668c2ecf20Sopenharmony_ci	u32 dmadptr;		/* Descriptor pointer. */
678c2ecf20Sopenharmony_ci	u32 dmandptr;		/* Next descriptor pointer. */
688c2ecf20Sopenharmony_ci};
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* DMA channels specific registers */
718c2ecf20Sopenharmony_ci#define DMA_CHAN_RUN_BIT		(1 << 0)
728c2ecf20Sopenharmony_ci#define DMA_CHAN_DONE_BIT		(1 << 1)
738c2ecf20Sopenharmony_ci#define DMA_CHAN_MODE_BIT		(1 << 2)
748c2ecf20Sopenharmony_ci#define DMA_CHAN_MODE_MSK		0x0000000c
758c2ecf20Sopenharmony_ci#define	 DMA_CHAN_MODE_AUTO		0
768c2ecf20Sopenharmony_ci#define	 DMA_CHAN_MODE_BURST		1
778c2ecf20Sopenharmony_ci#define	 DMA_CHAN_MODE_XFRT		2
788c2ecf20Sopenharmony_ci#define	 DMA_CHAN_MODE_RSVD		3
798c2ecf20Sopenharmony_ci#define DMA_CHAN_ACT_BIT		(1 << 4)
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci/* DMA status registers */
828c2ecf20Sopenharmony_ci#define DMA_STAT_FINI			(1 << 0)
838c2ecf20Sopenharmony_ci#define DMA_STAT_DONE			(1 << 1)
848c2ecf20Sopenharmony_ci#define DMA_STAT_CHAIN			(1 << 2)
858c2ecf20Sopenharmony_ci#define DMA_STAT_ERR			(1 << 3)
868c2ecf20Sopenharmony_ci#define DMA_STAT_HALT			(1 << 4)
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci/*
898c2ecf20Sopenharmony_ci * DMA channel definitions
908c2ecf20Sopenharmony_ci */
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define DMA_CHAN_ETH_RCV		0
938c2ecf20Sopenharmony_ci#define DMA_CHAN_ETH_XMT		1
948c2ecf20Sopenharmony_ci#define DMA_CHAN_MEM_TO_FIFO		2
958c2ecf20Sopenharmony_ci#define DMA_CHAN_FIFO_TO_MEM		3
968c2ecf20Sopenharmony_ci#define DMA_CHAN_PCI_TO_MEM		4
978c2ecf20Sopenharmony_ci#define DMA_CHAN_MEM_TO_PCI		5
988c2ecf20Sopenharmony_ci#define DMA_CHAN_COUNT			6
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_cistruct dma_channel {
1018c2ecf20Sopenharmony_ci	struct dma_reg ch[DMA_CHAN_COUNT];
1028c2ecf20Sopenharmony_ci};
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci#endif	/* __ASM_RC32434_DMA_H */
105