2 * SH4 CPU-specific DMA definitions, used by both DMA drivers
4 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 #ifndef CPU_DMA_REGISTER_H
11 #define CPU_DMA_REGISTER_H
13 /* SH7751/7760/7780 DMA IRQ sources */
15 #ifdef CONFIG_CPU_SH4A
17 #define DMAOR_INIT DMAOR_DME
19 #if defined(CONFIG_CPU_SUBTYPE_SH7343) || \
20 defined(CONFIG_CPU_SUBTYPE_SH7730)
21 #define CHCR_TS_LOW_MASK 0x00000018
22 #define CHCR_TS_LOW_SHIFT 3
23 #define CHCR_TS_HIGH_MASK 0
24 #define CHCR_TS_HIGH_SHIFT 0
25 #elif defined(CONFIG_CPU_SUBTYPE_SH7722) || \
26 defined(CONFIG_CPU_SUBTYPE_SH7724)
27 #define CHCR_TS_LOW_MASK 0x00000018
28 #define CHCR_TS_LOW_SHIFT 3
29 #define CHCR_TS_HIGH_MASK 0x00300000
30 #define CHCR_TS_HIGH_SHIFT (20 - 2) /* 2 bits for shifted low TS */
31 #elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
32 defined(CONFIG_CPU_SUBTYPE_SH7764)
33 #define CHCR_TS_LOW_MASK 0x00000018
34 #define CHCR_TS_LOW_SHIFT 3
35 #define CHCR_TS_HIGH_MASK 0
36 #define CHCR_TS_HIGH_SHIFT 0
37 #elif defined(CONFIG_CPU_SUBTYPE_SH7723)
38 #define CHCR_TS_LOW_MASK 0x00000018
39 #define CHCR_TS_LOW_SHIFT 3
40 #define CHCR_TS_HIGH_MASK 0
41 #define CHCR_TS_HIGH_SHIFT 0
42 #elif defined(CONFIG_CPU_SUBTYPE_SH7780)
43 #define CHCR_TS_LOW_MASK 0x00000018
44 #define CHCR_TS_LOW_SHIFT 3
45 #define CHCR_TS_HIGH_MASK 0
46 #define CHCR_TS_HIGH_SHIFT 0
48 #define CHCR_TS_LOW_MASK 0x00000018
49 #define CHCR_TS_LOW_SHIFT 3
50 #define CHCR_TS_HIGH_MASK 0
51 #define CHCR_TS_HIGH_SHIFT 0
54 /* Transmit sizes and respective CHCR register values */
62 XMIT_SZ_128BIT_BLK
= 0xb,
63 XMIT_SZ_256BIT_BLK
= 0xc,
66 /* log2(size / 8) - used to calculate number of transfers */
69 [XMIT_SZ_16BIT] = 1, \
70 [XMIT_SZ_32BIT] = 2, \
71 [XMIT_SZ_64BIT] = 3, \
72 [XMIT_SZ_128BIT] = 4, \
73 [XMIT_SZ_256BIT] = 5, \
74 [XMIT_SZ_128BIT_BLK] = 4, \
75 [XMIT_SZ_256BIT_BLK] = 5, \
78 #define TS_INDEX2VAL(i) ((((i) & 3) << CHCR_TS_LOW_SHIFT) | \
79 ((((i) >> 2) & 3) << CHCR_TS_HIGH_SHIFT))
81 #else /* CONFIG_CPU_SH4A */
83 #define DMAOR_INIT (0x8000 | DMAOR_DME)
85 #define CHCR_TS_LOW_MASK 0x70
86 #define CHCR_TS_LOW_SHIFT 4
87 #define CHCR_TS_HIGH_MASK 0
88 #define CHCR_TS_HIGH_SHIFT 0
90 /* Transmit sizes and respective CHCR register values */
99 /* log2(size / 8) - used to calculate number of transfers */
101 [XMIT_SZ_8BIT] = 0, \
102 [XMIT_SZ_16BIT] = 1, \
103 [XMIT_SZ_32BIT] = 2, \
104 [XMIT_SZ_64BIT] = 3, \
105 [XMIT_SZ_256BIT] = 5, \
108 #define TS_INDEX2VAL(i) (((i) & 7) << CHCR_TS_LOW_SHIFT)
110 #endif /* CONFIG_CPU_SH4A */