18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2018-2019 Synopsys, Inc. and/or its affiliates.
48c2ecf20Sopenharmony_ci * Synopsys DesignWare eDMA v0 core
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Author: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef _DW_EDMA_V0_REGS_H
108c2ecf20Sopenharmony_ci#define _DW_EDMA_V0_REGS_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/dmaengine.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define EDMA_V0_MAX_NR_CH				8
158c2ecf20Sopenharmony_ci#define EDMA_V0_VIEWPORT_MASK				GENMASK(2, 0)
168c2ecf20Sopenharmony_ci#define EDMA_V0_DONE_INT_MASK				GENMASK(7, 0)
178c2ecf20Sopenharmony_ci#define EDMA_V0_ABORT_INT_MASK				GENMASK(23, 16)
188c2ecf20Sopenharmony_ci#define EDMA_V0_WRITE_CH_COUNT_MASK			GENMASK(3, 0)
198c2ecf20Sopenharmony_ci#define EDMA_V0_READ_CH_COUNT_MASK			GENMASK(19, 16)
208c2ecf20Sopenharmony_ci#define EDMA_V0_CH_STATUS_MASK				GENMASK(6, 5)
218c2ecf20Sopenharmony_ci#define EDMA_V0_DOORBELL_CH_MASK			GENMASK(2, 0)
228c2ecf20Sopenharmony_ci#define EDMA_V0_LINKED_LIST_ERR_MASK			GENMASK(7, 0)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define EDMA_V0_CH_ODD_MSI_DATA_MASK			GENMASK(31, 16)
258c2ecf20Sopenharmony_ci#define EDMA_V0_CH_EVEN_MSI_DATA_MASK			GENMASK(15, 0)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistruct dw_edma_v0_ch_regs {
288c2ecf20Sopenharmony_ci	u32 ch_control1;				/* 0x000 */
298c2ecf20Sopenharmony_ci	u32 ch_control2;				/* 0x004 */
308c2ecf20Sopenharmony_ci	u32 transfer_size;				/* 0x008 */
318c2ecf20Sopenharmony_ci	u32 sar_low;					/* 0x00c */
328c2ecf20Sopenharmony_ci	u32 sar_high;					/* 0x010 */
338c2ecf20Sopenharmony_ci	u32 dar_low;					/* 0x014 */
348c2ecf20Sopenharmony_ci	u32 dar_high;					/* 0x018 */
358c2ecf20Sopenharmony_ci	u32 llp_low;					/* 0x01c */
368c2ecf20Sopenharmony_ci	u32 llp_high;					/* 0x020 */
378c2ecf20Sopenharmony_ci};
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistruct dw_edma_v0_ch {
408c2ecf20Sopenharmony_ci	struct dw_edma_v0_ch_regs wr;			/* 0x200 */
418c2ecf20Sopenharmony_ci	u32 padding_1[55];				/* [0x224..0x2fc] */
428c2ecf20Sopenharmony_ci	struct dw_edma_v0_ch_regs rd;			/* 0x300 */
438c2ecf20Sopenharmony_ci	u32 padding_2[55];				/* [0x324..0x3fc] */
448c2ecf20Sopenharmony_ci};
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_cistruct dw_edma_v0_unroll {
478c2ecf20Sopenharmony_ci	u32 padding_1;					/* 0x0f8 */
488c2ecf20Sopenharmony_ci	u32 wr_engine_chgroup;				/* 0x100 */
498c2ecf20Sopenharmony_ci	u32 rd_engine_chgroup;				/* 0x104 */
508c2ecf20Sopenharmony_ci	u32 wr_engine_hshake_cnt_low;			/* 0x108 */
518c2ecf20Sopenharmony_ci	u32 wr_engine_hshake_cnt_high;			/* 0x10c */
528c2ecf20Sopenharmony_ci	u32 padding_2[2];				/* [0x110..0x114] */
538c2ecf20Sopenharmony_ci	u32 rd_engine_hshake_cnt_low;			/* 0x118 */
548c2ecf20Sopenharmony_ci	u32 rd_engine_hshake_cnt_high;			/* 0x11c */
558c2ecf20Sopenharmony_ci	u32 padding_3[2];				/* [0x120..0x124] */
568c2ecf20Sopenharmony_ci	u32 wr_ch0_pwr_en;				/* 0x128 */
578c2ecf20Sopenharmony_ci	u32 wr_ch1_pwr_en;				/* 0x12c */
588c2ecf20Sopenharmony_ci	u32 wr_ch2_pwr_en;				/* 0x130 */
598c2ecf20Sopenharmony_ci	u32 wr_ch3_pwr_en;				/* 0x134 */
608c2ecf20Sopenharmony_ci	u32 wr_ch4_pwr_en;				/* 0x138 */
618c2ecf20Sopenharmony_ci	u32 wr_ch5_pwr_en;				/* 0x13c */
628c2ecf20Sopenharmony_ci	u32 wr_ch6_pwr_en;				/* 0x140 */
638c2ecf20Sopenharmony_ci	u32 wr_ch7_pwr_en;				/* 0x144 */
648c2ecf20Sopenharmony_ci	u32 padding_4[8];				/* [0x148..0x164] */
658c2ecf20Sopenharmony_ci	u32 rd_ch0_pwr_en;				/* 0x168 */
668c2ecf20Sopenharmony_ci	u32 rd_ch1_pwr_en;				/* 0x16c */
678c2ecf20Sopenharmony_ci	u32 rd_ch2_pwr_en;				/* 0x170 */
688c2ecf20Sopenharmony_ci	u32 rd_ch3_pwr_en;				/* 0x174 */
698c2ecf20Sopenharmony_ci	u32 rd_ch4_pwr_en;				/* 0x178 */
708c2ecf20Sopenharmony_ci	u32 rd_ch5_pwr_en;				/* 0x18c */
718c2ecf20Sopenharmony_ci	u32 rd_ch6_pwr_en;				/* 0x180 */
728c2ecf20Sopenharmony_ci	u32 rd_ch7_pwr_en;				/* 0x184 */
738c2ecf20Sopenharmony_ci	u32 padding_5[30];				/* [0x188..0x1fc] */
748c2ecf20Sopenharmony_ci	struct dw_edma_v0_ch ch[EDMA_V0_MAX_NR_CH];	/* [0x200..0x1120] */
758c2ecf20Sopenharmony_ci};
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_cistruct dw_edma_v0_legacy {
788c2ecf20Sopenharmony_ci	u32 viewport_sel;				/* 0x0f8 */
798c2ecf20Sopenharmony_ci	struct dw_edma_v0_ch_regs ch;			/* [0x100..0x120] */
808c2ecf20Sopenharmony_ci};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_cistruct dw_edma_v0_regs {
838c2ecf20Sopenharmony_ci	/* eDMA global registers */
848c2ecf20Sopenharmony_ci	u32 ctrl_data_arb_prior;			/* 0x000 */
858c2ecf20Sopenharmony_ci	u32 padding_1;					/* 0x004 */
868c2ecf20Sopenharmony_ci	u32 ctrl;					/* 0x008 */
878c2ecf20Sopenharmony_ci	u32 wr_engine_en;				/* 0x00c */
888c2ecf20Sopenharmony_ci	u32 wr_doorbell;				/* 0x010 */
898c2ecf20Sopenharmony_ci	u32 padding_2;					/* 0x014 */
908c2ecf20Sopenharmony_ci	u32 wr_ch_arb_weight_low;			/* 0x018 */
918c2ecf20Sopenharmony_ci	u32 wr_ch_arb_weight_high;			/* 0x01c */
928c2ecf20Sopenharmony_ci	u32 padding_3[3];				/* [0x020..0x028] */
938c2ecf20Sopenharmony_ci	u32 rd_engine_en;				/* 0x02c */
948c2ecf20Sopenharmony_ci	u32 rd_doorbell;				/* 0x030 */
958c2ecf20Sopenharmony_ci	u32 padding_4;					/* 0x034 */
968c2ecf20Sopenharmony_ci	u32 rd_ch_arb_weight_low;			/* 0x038 */
978c2ecf20Sopenharmony_ci	u32 rd_ch_arb_weight_high;			/* 0x03c */
988c2ecf20Sopenharmony_ci	u32 padding_5[3];				/* [0x040..0x048] */
998c2ecf20Sopenharmony_ci	/* eDMA interrupts registers */
1008c2ecf20Sopenharmony_ci	u32 wr_int_status;				/* 0x04c */
1018c2ecf20Sopenharmony_ci	u32 padding_6;					/* 0x050 */
1028c2ecf20Sopenharmony_ci	u32 wr_int_mask;				/* 0x054 */
1038c2ecf20Sopenharmony_ci	u32 wr_int_clear;				/* 0x058 */
1048c2ecf20Sopenharmony_ci	u32 wr_err_status;				/* 0x05c */
1058c2ecf20Sopenharmony_ci	u32 wr_done_imwr_low;				/* 0x060 */
1068c2ecf20Sopenharmony_ci	u32 wr_done_imwr_high;				/* 0x064 */
1078c2ecf20Sopenharmony_ci	u32 wr_abort_imwr_low;				/* 0x068 */
1088c2ecf20Sopenharmony_ci	u32 wr_abort_imwr_high;				/* 0x06c */
1098c2ecf20Sopenharmony_ci	u32 wr_ch01_imwr_data;				/* 0x070 */
1108c2ecf20Sopenharmony_ci	u32 wr_ch23_imwr_data;				/* 0x074 */
1118c2ecf20Sopenharmony_ci	u32 wr_ch45_imwr_data;				/* 0x078 */
1128c2ecf20Sopenharmony_ci	u32 wr_ch67_imwr_data;				/* 0x07c */
1138c2ecf20Sopenharmony_ci	u32 padding_7[4];				/* [0x080..0x08c] */
1148c2ecf20Sopenharmony_ci	u32 wr_linked_list_err_en;			/* 0x090 */
1158c2ecf20Sopenharmony_ci	u32 padding_8[3];				/* [0x094..0x09c] */
1168c2ecf20Sopenharmony_ci	u32 rd_int_status;				/* 0x0a0 */
1178c2ecf20Sopenharmony_ci	u32 padding_9;					/* 0x0a4 */
1188c2ecf20Sopenharmony_ci	u32 rd_int_mask;				/* 0x0a8 */
1198c2ecf20Sopenharmony_ci	u32 rd_int_clear;				/* 0x0ac */
1208c2ecf20Sopenharmony_ci	u32 padding_10;					/* 0x0b0 */
1218c2ecf20Sopenharmony_ci	u32 rd_err_status_low;				/* 0x0b4 */
1228c2ecf20Sopenharmony_ci	u32 rd_err_status_high;				/* 0x0b8 */
1238c2ecf20Sopenharmony_ci	u32 padding_11[2];				/* [0x0bc..0x0c0] */
1248c2ecf20Sopenharmony_ci	u32 rd_linked_list_err_en;			/* 0x0c4 */
1258c2ecf20Sopenharmony_ci	u32 padding_12;					/* 0x0c8 */
1268c2ecf20Sopenharmony_ci	u32 rd_done_imwr_low;				/* 0x0cc */
1278c2ecf20Sopenharmony_ci	u32 rd_done_imwr_high;				/* 0x0d0 */
1288c2ecf20Sopenharmony_ci	u32 rd_abort_imwr_low;				/* 0x0d4 */
1298c2ecf20Sopenharmony_ci	u32 rd_abort_imwr_high;				/* 0x0d8 */
1308c2ecf20Sopenharmony_ci	u32 rd_ch01_imwr_data;				/* 0x0dc */
1318c2ecf20Sopenharmony_ci	u32 rd_ch23_imwr_data;				/* 0x0e0 */
1328c2ecf20Sopenharmony_ci	u32 rd_ch45_imwr_data;				/* 0x0e4 */
1338c2ecf20Sopenharmony_ci	u32 rd_ch67_imwr_data;				/* 0x0e8 */
1348c2ecf20Sopenharmony_ci	u32 padding_13[4];				/* [0x0ec..0x0f8] */
1358c2ecf20Sopenharmony_ci	/* eDMA channel context grouping */
1368c2ecf20Sopenharmony_ci	union dw_edma_v0_type {
1378c2ecf20Sopenharmony_ci		struct dw_edma_v0_legacy legacy;	/* [0x0f8..0x120] */
1388c2ecf20Sopenharmony_ci		struct dw_edma_v0_unroll unroll;	/* [0x0f8..0x1120] */
1398c2ecf20Sopenharmony_ci	} type;
1408c2ecf20Sopenharmony_ci};
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_cistruct dw_edma_v0_lli {
1438c2ecf20Sopenharmony_ci	u32 control;
1448c2ecf20Sopenharmony_ci	u32 transfer_size;
1458c2ecf20Sopenharmony_ci	u32 sar_low;
1468c2ecf20Sopenharmony_ci	u32 sar_high;
1478c2ecf20Sopenharmony_ci	u32 dar_low;
1488c2ecf20Sopenharmony_ci	u32 dar_high;
1498c2ecf20Sopenharmony_ci};
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_cistruct dw_edma_v0_llp {
1528c2ecf20Sopenharmony_ci	u32 control;
1538c2ecf20Sopenharmony_ci	u32 reserved;
1548c2ecf20Sopenharmony_ci	u32 llp_low;
1558c2ecf20Sopenharmony_ci	u32 llp_high;
1568c2ecf20Sopenharmony_ci};
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci#endif /* _DW_EDMA_V0_REGS_H */
159