2 * SH-ARM CPU-specific DMA definitions, used by both DMA drivers
4 * Copyright (C) 2012 Renesas Solutions Corp
6 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
8 * Based on arch/sh/include/cpu-sh4/cpu/dma-register.h
9 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
16 #ifndef DMA_REGISTER_H
17 #define DMA_REGISTER_H
20 * Direct Memory Access Controller
23 /* Transmit sizes and respective CHCR register values */
34 /* log2(size / 8) - used to calculate number of transfers */
35 static const unsigned int dma_ts_shift
[] = {
45 #define TS_LOW_BIT 0x3 /* --xx */
46 #define TS_HI_BIT 0xc /* xx-- */
48 #define TS_LOW_SHIFT (3)
49 #define TS_HI_SHIFT (20 - 2) /* 2 bits for shifted low TS */
51 #define TS_INDEX2VAL(i) \
52 ((((i) & TS_LOW_BIT) << TS_LOW_SHIFT) |\
53 (((i) & TS_HI_BIT) << TS_HI_SHIFT))
55 #define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL((xmit_sz)))
56 #define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL((xmit_sz)))
62 /* Transmit sizes and respective CHCR register values */
64 USBTS_XMIT_SZ_8BYTE
= 0,
65 USBTS_XMIT_SZ_16BYTE
= 1,
66 USBTS_XMIT_SZ_32BYTE
= 2,
69 /* log2(size / 8) - used to calculate number of transfers */
70 static const unsigned int dma_usbts_shift
[] = {
71 [USBTS_XMIT_SZ_8BYTE
] = 3,
72 [USBTS_XMIT_SZ_16BYTE
] = 4,
73 [USBTS_XMIT_SZ_32BYTE
] = 5,
76 #define USBTS_LOW_BIT 0x3 /* --xx */
77 #define USBTS_HI_BIT 0x0 /* ---- */
79 #define USBTS_LOW_SHIFT 6
80 #define USBTS_HI_SHIFT 0
82 #define USBTS_INDEX2VAL(i) (((i) & 3) << 6)
84 #endif /* DMA_REGISTER_H */