1 /* SPDX-License-Identifier: GPL-2.0
3 * SH4 CPU-specific DMA definitions, used by both DMA drivers
5 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
7 #ifndef CPU_DMA_REGISTER_H
8 #define CPU_DMA_REGISTER_H
10 /* SH7751/7760/7780 DMA IRQ sources */
12 #ifdef CONFIG_CPU_SH4A
14 #define DMAOR_INIT DMAOR_DME
16 #if defined(CONFIG_CPU_SUBTYPE_SH7343)
17 #define CHCR_TS_LOW_MASK 0x00000018
18 #define CHCR_TS_LOW_SHIFT 3
19 #define CHCR_TS_HIGH_MASK 0
20 #define CHCR_TS_HIGH_SHIFT 0
21 #elif defined(CONFIG_CPU_SUBTYPE_SH7722) || \
22 defined(CONFIG_CPU_SUBTYPE_SH7723) || \
23 defined(CONFIG_CPU_SUBTYPE_SH7724) || \
24 defined(CONFIG_CPU_SUBTYPE_SH7730) || \
25 defined(CONFIG_CPU_SUBTYPE_SH7786)
26 #define CHCR_TS_LOW_MASK 0x00000018
27 #define CHCR_TS_LOW_SHIFT 3
28 #define CHCR_TS_HIGH_MASK 0x00300000
29 #define CHCR_TS_HIGH_SHIFT (20 - 2) /* 2 bits for shifted low TS */
30 #elif defined(CONFIG_CPU_SUBTYPE_SH7757) || \
31 defined(CONFIG_CPU_SUBTYPE_SH7763) || \
32 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
33 defined(CONFIG_CPU_SUBTYPE_SH7785)
34 #define CHCR_TS_LOW_MASK 0x00000018
35 #define CHCR_TS_LOW_SHIFT 3
36 #define CHCR_TS_HIGH_MASK 0x00100000
37 #define CHCR_TS_HIGH_SHIFT (20 - 2) /* 2 bits for shifted low TS */
40 /* Transmit sizes and respective CHCR register values */
48 XMIT_SZ_128BIT_BLK
= 0xb,
49 XMIT_SZ_256BIT_BLK
= 0xc,
52 /* log2(size / 8) - used to calculate number of transfers */
55 [XMIT_SZ_16BIT] = 1, \
56 [XMIT_SZ_32BIT] = 2, \
57 [XMIT_SZ_64BIT] = 3, \
58 [XMIT_SZ_128BIT] = 4, \
59 [XMIT_SZ_256BIT] = 5, \
60 [XMIT_SZ_128BIT_BLK] = 4, \
61 [XMIT_SZ_256BIT_BLK] = 5, \
64 #define TS_INDEX2VAL(i) ((((i) & 3) << CHCR_TS_LOW_SHIFT) | \
65 (((i) & 0xc) << CHCR_TS_HIGH_SHIFT))
67 #else /* CONFIG_CPU_SH4A */
69 #define DMAOR_INIT (0x8000 | DMAOR_DME)
71 #define CHCR_TS_LOW_MASK 0x70
72 #define CHCR_TS_LOW_SHIFT 4
73 #define CHCR_TS_HIGH_MASK 0
74 #define CHCR_TS_HIGH_SHIFT 0
76 /* Transmit sizes and respective CHCR register values */
85 /* log2(size / 8) - used to calculate number of transfers */
88 [XMIT_SZ_16BIT] = 1, \
89 [XMIT_SZ_32BIT] = 2, \
90 [XMIT_SZ_64BIT] = 3, \
91 [XMIT_SZ_256BIT] = 5, \
94 #define TS_INDEX2VAL(i) (((i) & 7) << CHCR_TS_LOW_SHIFT)
96 #endif /* CONFIG_CPU_SH4A */