17e4b8a4fSGustavo Pimentel /* SPDX-License-Identifier: GPL-2.0 */ 27e4b8a4fSGustavo Pimentel /* 37e4b8a4fSGustavo Pimentel * Copyright (c) 2018-2019 Synopsys, Inc. and/or its affiliates. 47e4b8a4fSGustavo Pimentel * Synopsys DesignWare eDMA v0 core 57e4b8a4fSGustavo Pimentel * 67e4b8a4fSGustavo Pimentel * Author: Gustavo Pimentel <gustavo.pimentel@synopsys.com> 77e4b8a4fSGustavo Pimentel */ 87e4b8a4fSGustavo Pimentel 97e4b8a4fSGustavo Pimentel #ifndef _DW_EDMA_V0_REGS_H 107e4b8a4fSGustavo Pimentel #define _DW_EDMA_V0_REGS_H 117e4b8a4fSGustavo Pimentel 127e4b8a4fSGustavo Pimentel #include <linux/dmaengine.h> 137e4b8a4fSGustavo Pimentel 147e4b8a4fSGustavo Pimentel #define EDMA_V0_MAX_NR_CH 8 157e4b8a4fSGustavo Pimentel #define EDMA_V0_VIEWPORT_MASK GENMASK(2, 0) 167e4b8a4fSGustavo Pimentel #define EDMA_V0_DONE_INT_MASK GENMASK(7, 0) 177e4b8a4fSGustavo Pimentel #define EDMA_V0_ABORT_INT_MASK GENMASK(23, 16) 187e4b8a4fSGustavo Pimentel #define EDMA_V0_WRITE_CH_COUNT_MASK GENMASK(3, 0) 197e4b8a4fSGustavo Pimentel #define EDMA_V0_READ_CH_COUNT_MASK GENMASK(19, 16) 207e4b8a4fSGustavo Pimentel #define EDMA_V0_CH_STATUS_MASK GENMASK(6, 5) 217e4b8a4fSGustavo Pimentel #define EDMA_V0_DOORBELL_CH_MASK GENMASK(2, 0) 227e4b8a4fSGustavo Pimentel #define EDMA_V0_LINKED_LIST_ERR_MASK GENMASK(7, 0) 237e4b8a4fSGustavo Pimentel 247e4b8a4fSGustavo Pimentel #define EDMA_V0_CH_ODD_MSI_DATA_MASK GENMASK(31, 16) 257e4b8a4fSGustavo Pimentel #define EDMA_V0_CH_EVEN_MSI_DATA_MASK GENMASK(15, 0) 267e4b8a4fSGustavo Pimentel 277e4b8a4fSGustavo Pimentel struct dw_edma_v0_ch_regs { 28*b79f1751SGustavo Pimentel u32 ch_control1; /* 0x0000 */ 29*b79f1751SGustavo Pimentel u32 ch_control2; /* 0x0004 */ 30*b79f1751SGustavo Pimentel u32 transfer_size; /* 0x0008 */ 3104e0a39fSGustavo Pimentel union { 32*b79f1751SGustavo Pimentel u64 reg; /* 0x000c..0x0010 */ 3304e0a39fSGustavo Pimentel struct { 34*b79f1751SGustavo Pimentel u32 lsb; /* 0x000c */ 35*b79f1751SGustavo Pimentel u32 msb; /* 0x0010 */ 367e4b8a4fSGustavo Pimentel }; 3704e0a39fSGustavo Pimentel } sar; 3804e0a39fSGustavo Pimentel union { 39*b79f1751SGustavo Pimentel u64 reg; /* 0x0014..0x0018 */ 4004e0a39fSGustavo Pimentel struct { 41*b79f1751SGustavo Pimentel u32 lsb; /* 0x0014 */ 42*b79f1751SGustavo Pimentel u32 msb; /* 0x0018 */ 4304e0a39fSGustavo Pimentel }; 4404e0a39fSGustavo Pimentel } dar; 4504e0a39fSGustavo Pimentel union { 46*b79f1751SGustavo Pimentel u64 reg; /* 0x001c..0x0020 */ 4704e0a39fSGustavo Pimentel struct { 48*b79f1751SGustavo Pimentel u32 lsb; /* 0x001c */ 49*b79f1751SGustavo Pimentel u32 msb; /* 0x0020 */ 5004e0a39fSGustavo Pimentel }; 5104e0a39fSGustavo Pimentel } llp; 5204e0a39fSGustavo Pimentel } __packed; 537e4b8a4fSGustavo Pimentel 547e4b8a4fSGustavo Pimentel struct dw_edma_v0_ch { 55*b79f1751SGustavo Pimentel struct dw_edma_v0_ch_regs wr; /* 0x0200 */ 56*b79f1751SGustavo Pimentel u32 padding_1[55]; /* 0x0224..0x02fc */ 57*b79f1751SGustavo Pimentel struct dw_edma_v0_ch_regs rd; /* 0x0300 */ 58*b79f1751SGustavo Pimentel u32 padding_2[55]; /* 0x0324..0x03fc */ 5904e0a39fSGustavo Pimentel } __packed; 607e4b8a4fSGustavo Pimentel 617e4b8a4fSGustavo Pimentel struct dw_edma_v0_unroll { 62*b79f1751SGustavo Pimentel u32 padding_1; /* 0x00f8 */ 63*b79f1751SGustavo Pimentel u32 wr_engine_chgroup; /* 0x0100 */ 64*b79f1751SGustavo Pimentel u32 rd_engine_chgroup; /* 0x0104 */ 6504e0a39fSGustavo Pimentel union { 66*b79f1751SGustavo Pimentel u64 reg; /* 0x0108..0x010c */ 6704e0a39fSGustavo Pimentel struct { 68*b79f1751SGustavo Pimentel u32 lsb; /* 0x0108 */ 69*b79f1751SGustavo Pimentel u32 msb; /* 0x010c */ 7004e0a39fSGustavo Pimentel }; 7104e0a39fSGustavo Pimentel } wr_engine_hshake_cnt; 72*b79f1751SGustavo Pimentel u32 padding_2[2]; /* 0x0110..0x0114 */ 7304e0a39fSGustavo Pimentel union { 74*b79f1751SGustavo Pimentel u64 reg; /* 0x0120..0x0124 */ 7504e0a39fSGustavo Pimentel struct { 76*b79f1751SGustavo Pimentel u32 lsb; /* 0x0120 */ 77*b79f1751SGustavo Pimentel u32 msb; /* 0x0124 */ 7804e0a39fSGustavo Pimentel }; 7904e0a39fSGustavo Pimentel } rd_engine_hshake_cnt; 80*b79f1751SGustavo Pimentel u32 padding_3[2]; /* 0x0120..0x0124 */ 81*b79f1751SGustavo Pimentel u32 wr_ch0_pwr_en; /* 0x0128 */ 82*b79f1751SGustavo Pimentel u32 wr_ch1_pwr_en; /* 0x012c */ 83*b79f1751SGustavo Pimentel u32 wr_ch2_pwr_en; /* 0x0130 */ 84*b79f1751SGustavo Pimentel u32 wr_ch3_pwr_en; /* 0x0134 */ 85*b79f1751SGustavo Pimentel u32 wr_ch4_pwr_en; /* 0x0138 */ 86*b79f1751SGustavo Pimentel u32 wr_ch5_pwr_en; /* 0x013c */ 87*b79f1751SGustavo Pimentel u32 wr_ch6_pwr_en; /* 0x0140 */ 88*b79f1751SGustavo Pimentel u32 wr_ch7_pwr_en; /* 0x0144 */ 89*b79f1751SGustavo Pimentel u32 padding_4[8]; /* 0x0148..0x0164 */ 90*b79f1751SGustavo Pimentel u32 rd_ch0_pwr_en; /* 0x0168 */ 91*b79f1751SGustavo Pimentel u32 rd_ch1_pwr_en; /* 0x016c */ 92*b79f1751SGustavo Pimentel u32 rd_ch2_pwr_en; /* 0x0170 */ 93*b79f1751SGustavo Pimentel u32 rd_ch3_pwr_en; /* 0x0174 */ 94*b79f1751SGustavo Pimentel u32 rd_ch4_pwr_en; /* 0x0178 */ 95*b79f1751SGustavo Pimentel u32 rd_ch5_pwr_en; /* 0x018c */ 96*b79f1751SGustavo Pimentel u32 rd_ch6_pwr_en; /* 0x0180 */ 97*b79f1751SGustavo Pimentel u32 rd_ch7_pwr_en; /* 0x0184 */ 98*b79f1751SGustavo Pimentel u32 padding_5[30]; /* 0x0188..0x01fc */ 99*b79f1751SGustavo Pimentel struct dw_edma_v0_ch ch[EDMA_V0_MAX_NR_CH]; /* 0x0200..0x1120 */ 10004e0a39fSGustavo Pimentel } __packed; 1017e4b8a4fSGustavo Pimentel 1027e4b8a4fSGustavo Pimentel struct dw_edma_v0_legacy { 103*b79f1751SGustavo Pimentel u32 viewport_sel; /* 0x00f8 */ 104*b79f1751SGustavo Pimentel struct dw_edma_v0_ch_regs ch; /* 0x0100..0x0120 */ 10504e0a39fSGustavo Pimentel } __packed; 1067e4b8a4fSGustavo Pimentel 1077e4b8a4fSGustavo Pimentel struct dw_edma_v0_regs { 1087e4b8a4fSGustavo Pimentel /* eDMA global registers */ 109*b79f1751SGustavo Pimentel u32 ctrl_data_arb_prior; /* 0x0000 */ 110*b79f1751SGustavo Pimentel u32 padding_1; /* 0x0004 */ 111*b79f1751SGustavo Pimentel u32 ctrl; /* 0x0008 */ 112*b79f1751SGustavo Pimentel u32 wr_engine_en; /* 0x000c */ 113*b79f1751SGustavo Pimentel u32 wr_doorbell; /* 0x0010 */ 114*b79f1751SGustavo Pimentel u32 padding_2; /* 0x0014 */ 11504e0a39fSGustavo Pimentel union { 116*b79f1751SGustavo Pimentel u64 reg; /* 0x0018..0x001c */ 11704e0a39fSGustavo Pimentel struct { 118*b79f1751SGustavo Pimentel u32 lsb; /* 0x0018 */ 119*b79f1751SGustavo Pimentel u32 msb; /* 0x001c */ 12004e0a39fSGustavo Pimentel }; 12104e0a39fSGustavo Pimentel } wr_ch_arb_weight; 122*b79f1751SGustavo Pimentel u32 padding_3[3]; /* 0x0020..0x0028 */ 123*b79f1751SGustavo Pimentel u32 rd_engine_en; /* 0x002c */ 124*b79f1751SGustavo Pimentel u32 rd_doorbell; /* 0x0030 */ 125*b79f1751SGustavo Pimentel u32 padding_4; /* 0x0034 */ 12604e0a39fSGustavo Pimentel union { 127*b79f1751SGustavo Pimentel u64 reg; /* 0x0038..0x003c */ 12804e0a39fSGustavo Pimentel struct { 129*b79f1751SGustavo Pimentel u32 lsb; /* 0x0038 */ 130*b79f1751SGustavo Pimentel u32 msb; /* 0x003c */ 13104e0a39fSGustavo Pimentel }; 13204e0a39fSGustavo Pimentel } rd_ch_arb_weight; 133*b79f1751SGustavo Pimentel u32 padding_5[3]; /* 0x0040..0x0048 */ 1347e4b8a4fSGustavo Pimentel /* eDMA interrupts registers */ 135*b79f1751SGustavo Pimentel u32 wr_int_status; /* 0x004c */ 136*b79f1751SGustavo Pimentel u32 padding_6; /* 0x0050 */ 137*b79f1751SGustavo Pimentel u32 wr_int_mask; /* 0x0054 */ 138*b79f1751SGustavo Pimentel u32 wr_int_clear; /* 0x0058 */ 139*b79f1751SGustavo Pimentel u32 wr_err_status; /* 0x005c */ 14004e0a39fSGustavo Pimentel union { 141*b79f1751SGustavo Pimentel u64 reg; /* 0x0060..0x0064 */ 14204e0a39fSGustavo Pimentel struct { 143*b79f1751SGustavo Pimentel u32 lsb; /* 0x0060 */ 144*b79f1751SGustavo Pimentel u32 msb; /* 0x0064 */ 14504e0a39fSGustavo Pimentel }; 14604e0a39fSGustavo Pimentel } wr_done_imwr; 14704e0a39fSGustavo Pimentel union { 148*b79f1751SGustavo Pimentel u64 reg; /* 0x0068..0x006c */ 14904e0a39fSGustavo Pimentel struct { 150*b79f1751SGustavo Pimentel u32 lsb; /* 0x0068 */ 151*b79f1751SGustavo Pimentel u32 msb; /* 0x006c */ 15204e0a39fSGustavo Pimentel }; 15304e0a39fSGustavo Pimentel } wr_abort_imwr; 154*b79f1751SGustavo Pimentel u32 wr_ch01_imwr_data; /* 0x0070 */ 155*b79f1751SGustavo Pimentel u32 wr_ch23_imwr_data; /* 0x0074 */ 156*b79f1751SGustavo Pimentel u32 wr_ch45_imwr_data; /* 0x0078 */ 157*b79f1751SGustavo Pimentel u32 wr_ch67_imwr_data; /* 0x007c */ 158*b79f1751SGustavo Pimentel u32 padding_7[4]; /* 0x0080..0x008c */ 159*b79f1751SGustavo Pimentel u32 wr_linked_list_err_en; /* 0x0090 */ 160*b79f1751SGustavo Pimentel u32 padding_8[3]; /* 0x0094..0x009c */ 161*b79f1751SGustavo Pimentel u32 rd_int_status; /* 0x00a0 */ 162*b79f1751SGustavo Pimentel u32 padding_9; /* 0x00a4 */ 163*b79f1751SGustavo Pimentel u32 rd_int_mask; /* 0x00a8 */ 164*b79f1751SGustavo Pimentel u32 rd_int_clear; /* 0x00ac */ 165*b79f1751SGustavo Pimentel u32 padding_10; /* 0x00b0 */ 16604e0a39fSGustavo Pimentel union { 167*b79f1751SGustavo Pimentel u64 reg; /* 0x00b4..0x00b8 */ 16804e0a39fSGustavo Pimentel struct { 169*b79f1751SGustavo Pimentel u32 lsb; /* 0x00b4 */ 170*b79f1751SGustavo Pimentel u32 msb; /* 0x00b8 */ 17104e0a39fSGustavo Pimentel }; 17204e0a39fSGustavo Pimentel } rd_err_status; 173*b79f1751SGustavo Pimentel u32 padding_11[2]; /* 0x00bc..0x00c0 */ 174*b79f1751SGustavo Pimentel u32 rd_linked_list_err_en; /* 0x00c4 */ 175*b79f1751SGustavo Pimentel u32 padding_12; /* 0x00c8 */ 17604e0a39fSGustavo Pimentel union { 177*b79f1751SGustavo Pimentel u64 reg; /* 0x00cc..0x00d0 */ 17804e0a39fSGustavo Pimentel struct { 179*b79f1751SGustavo Pimentel u32 lsb; /* 0x00cc */ 180*b79f1751SGustavo Pimentel u32 msb; /* 0x00d0 */ 18104e0a39fSGustavo Pimentel }; 18204e0a39fSGustavo Pimentel } rd_done_imwr; 18304e0a39fSGustavo Pimentel union { 184*b79f1751SGustavo Pimentel u64 reg; /* 0x00d4..0x00d8 */ 18504e0a39fSGustavo Pimentel struct { 186*b79f1751SGustavo Pimentel u32 lsb; /* 0x00d4 */ 187*b79f1751SGustavo Pimentel u32 msb; /* 0x00d8 */ 18804e0a39fSGustavo Pimentel }; 18904e0a39fSGustavo Pimentel } rd_abort_imwr; 190*b79f1751SGustavo Pimentel u32 rd_ch01_imwr_data; /* 0x00dc */ 191*b79f1751SGustavo Pimentel u32 rd_ch23_imwr_data; /* 0x00e0 */ 192*b79f1751SGustavo Pimentel u32 rd_ch45_imwr_data; /* 0x00e4 */ 193*b79f1751SGustavo Pimentel u32 rd_ch67_imwr_data; /* 0x00e8 */ 194*b79f1751SGustavo Pimentel u32 padding_13[4]; /* 0x00ec..0x00f8 */ 1957e4b8a4fSGustavo Pimentel /* eDMA channel context grouping */ 1967e4b8a4fSGustavo Pimentel union dw_edma_v0_type { 197*b79f1751SGustavo Pimentel struct dw_edma_v0_legacy legacy; /* 0x00f8..0x0120 */ 198*b79f1751SGustavo Pimentel struct dw_edma_v0_unroll unroll; /* 0x00f8..0x1120 */ 1997e4b8a4fSGustavo Pimentel } type; 20004e0a39fSGustavo Pimentel } __packed; 2017e4b8a4fSGustavo Pimentel 2027e4b8a4fSGustavo Pimentel struct dw_edma_v0_lli { 2037e4b8a4fSGustavo Pimentel u32 control; 2047e4b8a4fSGustavo Pimentel u32 transfer_size; 20504e0a39fSGustavo Pimentel union { 20604e0a39fSGustavo Pimentel u64 reg; 20704e0a39fSGustavo Pimentel struct { 20804e0a39fSGustavo Pimentel u32 lsb; 20904e0a39fSGustavo Pimentel u32 msb; 2107e4b8a4fSGustavo Pimentel }; 21104e0a39fSGustavo Pimentel } sar; 21204e0a39fSGustavo Pimentel union { 21304e0a39fSGustavo Pimentel u64 reg; 21404e0a39fSGustavo Pimentel struct { 21504e0a39fSGustavo Pimentel u32 lsb; 21604e0a39fSGustavo Pimentel u32 msb; 21704e0a39fSGustavo Pimentel }; 21804e0a39fSGustavo Pimentel } dar; 21904e0a39fSGustavo Pimentel } __packed; 2207e4b8a4fSGustavo Pimentel 2217e4b8a4fSGustavo Pimentel struct dw_edma_v0_llp { 2227e4b8a4fSGustavo Pimentel u32 control; 2237e4b8a4fSGustavo Pimentel u32 reserved; 22404e0a39fSGustavo Pimentel union { 22504e0a39fSGustavo Pimentel u64 reg; 22604e0a39fSGustavo Pimentel struct { 22704e0a39fSGustavo Pimentel u32 lsb; 22804e0a39fSGustavo Pimentel u32 msb; 2297e4b8a4fSGustavo Pimentel }; 23004e0a39fSGustavo Pimentel } llp; 23104e0a39fSGustavo Pimentel } __packed; 2327e4b8a4fSGustavo Pimentel 2337e4b8a4fSGustavo Pimentel #endif /* _DW_EDMA_V0_REGS_H */ 234