18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Renesas SuperH DMA Engine support 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2013 Renesas Electronics, Inc. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef SHDMA_ARM_H 98c2ecf20Sopenharmony_ci#define SHDMA_ARM_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include "shdma.h" 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* Transmit sizes and respective CHCR register values */ 148c2ecf20Sopenharmony_cienum { 158c2ecf20Sopenharmony_ci XMIT_SZ_8BIT = 0, 168c2ecf20Sopenharmony_ci XMIT_SZ_16BIT = 1, 178c2ecf20Sopenharmony_ci XMIT_SZ_32BIT = 2, 188c2ecf20Sopenharmony_ci XMIT_SZ_64BIT = 7, 198c2ecf20Sopenharmony_ci XMIT_SZ_128BIT = 3, 208c2ecf20Sopenharmony_ci XMIT_SZ_256BIT = 4, 218c2ecf20Sopenharmony_ci XMIT_SZ_512BIT = 5, 228c2ecf20Sopenharmony_ci}; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* log2(size / 8) - used to calculate number of transfers */ 258c2ecf20Sopenharmony_ci#define SH_DMAE_TS_SHIFT { \ 268c2ecf20Sopenharmony_ci [XMIT_SZ_8BIT] = 0, \ 278c2ecf20Sopenharmony_ci [XMIT_SZ_16BIT] = 1, \ 288c2ecf20Sopenharmony_ci [XMIT_SZ_32BIT] = 2, \ 298c2ecf20Sopenharmony_ci [XMIT_SZ_64BIT] = 3, \ 308c2ecf20Sopenharmony_ci [XMIT_SZ_128BIT] = 4, \ 318c2ecf20Sopenharmony_ci [XMIT_SZ_256BIT] = 5, \ 328c2ecf20Sopenharmony_ci [XMIT_SZ_512BIT] = 6, \ 338c2ecf20Sopenharmony_ci} 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define TS_LOW_BIT 0x3 /* --xx */ 368c2ecf20Sopenharmony_ci#define TS_HI_BIT 0xc /* xx-- */ 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define TS_LOW_SHIFT (3) 398c2ecf20Sopenharmony_ci#define TS_HI_SHIFT (20 - 2) /* 2 bits for shifted low TS */ 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define TS_INDEX2VAL(i) \ 428c2ecf20Sopenharmony_ci ((((i) & TS_LOW_BIT) << TS_LOW_SHIFT) |\ 438c2ecf20Sopenharmony_ci (((i) & TS_HI_BIT) << TS_HI_SHIFT)) 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL((xmit_sz))) 468c2ecf20Sopenharmony_ci#define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL((xmit_sz))) 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#endif 49