1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#include <linux/err.h>
22#include <linux/io.h>
23#include <linux/slab.h>
24#include <linux/module.h>
25#include <linux/init.h>
26#include <linux/device.h>
27#include <linux/dma-mapping.h>
28#include <linux/dmaengine.h>
29#include <linux/of.h>
30#include <linux/omap-dma.h>
31
32#include "soc.h"
33
34static const struct omap_dma_reg reg_map[] = {
35 [REVISION] = { 0x0000, 0x00, OMAP_DMA_REG_32BIT },
36 [GCR] = { 0x0078, 0x00, OMAP_DMA_REG_32BIT },
37 [IRQSTATUS_L0] = { 0x0008, 0x00, OMAP_DMA_REG_32BIT },
38 [IRQSTATUS_L1] = { 0x000c, 0x00, OMAP_DMA_REG_32BIT },
39 [IRQSTATUS_L2] = { 0x0010, 0x00, OMAP_DMA_REG_32BIT },
40 [IRQSTATUS_L3] = { 0x0014, 0x00, OMAP_DMA_REG_32BIT },
41 [IRQENABLE_L0] = { 0x0018, 0x00, OMAP_DMA_REG_32BIT },
42 [IRQENABLE_L1] = { 0x001c, 0x00, OMAP_DMA_REG_32BIT },
43 [IRQENABLE_L2] = { 0x0020, 0x00, OMAP_DMA_REG_32BIT },
44 [IRQENABLE_L3] = { 0x0024, 0x00, OMAP_DMA_REG_32BIT },
45 [SYSSTATUS] = { 0x0028, 0x00, OMAP_DMA_REG_32BIT },
46 [OCP_SYSCONFIG] = { 0x002c, 0x00, OMAP_DMA_REG_32BIT },
47 [CAPS_0] = { 0x0064, 0x00, OMAP_DMA_REG_32BIT },
48 [CAPS_2] = { 0x006c, 0x00, OMAP_DMA_REG_32BIT },
49 [CAPS_3] = { 0x0070, 0x00, OMAP_DMA_REG_32BIT },
50 [CAPS_4] = { 0x0074, 0x00, OMAP_DMA_REG_32BIT },
51
52
53 [CCR] = { 0x0080, 0x60, OMAP_DMA_REG_32BIT },
54 [CLNK_CTRL] = { 0x0084, 0x60, OMAP_DMA_REG_32BIT },
55 [CICR] = { 0x0088, 0x60, OMAP_DMA_REG_32BIT },
56 [CSR] = { 0x008c, 0x60, OMAP_DMA_REG_32BIT },
57 [CSDP] = { 0x0090, 0x60, OMAP_DMA_REG_32BIT },
58 [CEN] = { 0x0094, 0x60, OMAP_DMA_REG_32BIT },
59 [CFN] = { 0x0098, 0x60, OMAP_DMA_REG_32BIT },
60 [CSEI] = { 0x00a4, 0x60, OMAP_DMA_REG_32BIT },
61 [CSFI] = { 0x00a8, 0x60, OMAP_DMA_REG_32BIT },
62 [CDEI] = { 0x00ac, 0x60, OMAP_DMA_REG_32BIT },
63 [CDFI] = { 0x00b0, 0x60, OMAP_DMA_REG_32BIT },
64 [CSAC] = { 0x00b4, 0x60, OMAP_DMA_REG_32BIT },
65 [CDAC] = { 0x00b8, 0x60, OMAP_DMA_REG_32BIT },
66
67
68 [CSSA] = { 0x009c, 0x60, OMAP_DMA_REG_32BIT },
69 [CDSA] = { 0x00a0, 0x60, OMAP_DMA_REG_32BIT },
70 [CCEN] = { 0x00bc, 0x60, OMAP_DMA_REG_32BIT },
71 [CCFN] = { 0x00c0, 0x60, OMAP_DMA_REG_32BIT },
72 [COLOR] = { 0x00c4, 0x60, OMAP_DMA_REG_32BIT },
73
74
75 [CDP] = { 0x00d0, 0x60, OMAP_DMA_REG_32BIT },
76 [CNDP] = { 0x00d4, 0x60, OMAP_DMA_REG_32BIT },
77 [CCDN] = { 0x00d8, 0x60, OMAP_DMA_REG_32BIT },
78};
79
80static unsigned configure_dma_errata(void)
81{
82 unsigned errata = 0;
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110 if (cpu_is_omap2420() || (cpu_is_omap2430() &&
111 (omap_type() == OMAP2430_REV_ES1_0))) {
112
113 SET_DMA_ERRATA(DMA_ERRATA_IFRAME_BUFFERING);
114 SET_DMA_ERRATA(DMA_ERRATA_PARALLEL_CHANNELS);
115 }
116
117
118
119
120
121
122 if (cpu_class_is_omap2())
123 SET_DMA_ERRATA(DMA_ERRATA_i378);
124
125
126
127
128
129
130
131
132
133 if (cpu_is_omap34xx())
134 SET_DMA_ERRATA(DMA_ERRATA_i541);
135
136
137
138
139
140
141
142 if (omap_type() == OMAP3430_REV_ES1_0)
143 SET_DMA_ERRATA(DMA_ERRATA_i88);
144
145
146
147
148
149 SET_DMA_ERRATA(DMA_ERRATA_3_3);
150
151
152
153
154
155
156
157
158 if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
159 SET_DMA_ERRATA(DMA_ROMCODE_BUG);
160
161 return errata;
162}
163
164static const struct dma_slave_map omap24xx_sdma_dt_map[] = {
165
166 { "musb-hdrc.1.auto", "dmareq0", SDMA_FILTER_PARAM(2) },
167 { "musb-hdrc.1.auto", "dmareq1", SDMA_FILTER_PARAM(3) },
168 { "musb-hdrc.1.auto", "dmareq2", SDMA_FILTER_PARAM(14) },
169 { "musb-hdrc.1.auto", "dmareq3", SDMA_FILTER_PARAM(15) },
170 { "musb-hdrc.1.auto", "dmareq4", SDMA_FILTER_PARAM(16) },
171 { "musb-hdrc.1.auto", "dmareq5", SDMA_FILTER_PARAM(64) },
172};
173
174static struct omap_dma_dev_attr dma_attr = {
175 .dev_caps = RESERVE_CHANNEL | DMA_LINKED_LCH | GLOBAL_PRIORITY |
176 IS_CSSA_32 | IS_CDSA_32,
177 .lch_count = 32,
178};
179
180struct omap_system_dma_plat_info dma_plat_info = {
181 .reg_map = reg_map,
182 .channel_stride = 0x60,
183 .dma_attr = &dma_attr,
184};
185
186
187static int __init omap2_system_dma_init(void)
188{
189 dma_plat_info.errata = configure_dma_errata();
190
191 if (soc_is_omap24xx()) {
192
193 dma_plat_info.slave_map = omap24xx_sdma_dt_map;
194 dma_plat_info.slavecnt = ARRAY_SIZE(omap24xx_sdma_dt_map);
195 }
196
197 if (!soc_is_omap242x())
198 dma_attr.dev_caps |= IS_RW_PRIORITY;
199
200 if (soc_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
201 dma_attr.dev_caps |= HS_CHANNELS_RESERVED;
202
203 return 0;
204}
205omap_arch_initcall(omap2_system_dma_init);
206