33
33
#define SUN4I_DMA_CFG_SRC_ADDR_MODE (mode ) ((mode) << 5)
34
34
#define SUN4I_DMA_CFG_SRC_DRQ_TYPE (type ) (type)
35
35
36
+ #define SUNIV_DMA_CFG_DST_DATA_WIDTH (width ) ((width) << 24)
37
+ #define SUNIV_DMA_CFG_SRC_DATA_WIDTH (width ) ((width) << 8)
38
+
36
39
#define SUN4I_MAX_BURST 8
40
+ #define SUNIV_MAX_BURST 4
37
41
38
42
/** Normal DMA register values **/
39
43
40
44
/* Normal DMA source/destination data request type values */
41
45
#define SUN4I_NDMA_DRQ_TYPE_SDRAM 0x16
42
46
#define SUN4I_NDMA_DRQ_TYPE_LIMIT (0x1F + 1)
43
47
48
+ #define SUNIV_NDMA_DRQ_TYPE_SDRAM 0x11
49
+ #define SUNIV_NDMA_DRQ_TYPE_LIMIT (0x17 + 1)
50
+
44
51
/** Normal DMA register layout **/
45
52
46
53
/* Dedicated DMA source/destination address mode values */
54
61
#define SUN4I_NDMA_CFG_BYTE_COUNT_MODE_REMAIN BIT(15)
55
62
#define SUN4I_NDMA_CFG_SRC_NON_SECURE BIT(6)
56
63
64
+ #define SUNIV_NDMA_CFG_CONT_MODE BIT(29)
65
+ #define SUNIV_NDMA_CFG_WAIT_STATE (n ) ((n) << 26)
66
+
57
67
/** Dedicated DMA register values **/
58
68
59
69
/* Dedicated DMA source/destination address mode values */
66
76
#define SUN4I_DDMA_DRQ_TYPE_SDRAM 0x1
67
77
#define SUN4I_DDMA_DRQ_TYPE_LIMIT (0x1F + 1)
68
78
79
+ #define SUNIV_DDMA_DRQ_TYPE_SDRAM 0x1
80
+ #define SUNIV_DDMA_DRQ_TYPE_LIMIT (0x9 + 1)
81
+
69
82
/** Dedicated DMA register layout **/
70
83
71
84
/* Dedicated DMA configuration register layout */
119
132
#define SUN4I_DMA_NR_MAX_VCHANS \
120
133
(SUN4I_NDMA_NR_MAX_VCHANS + SUN4I_DDMA_NR_MAX_VCHANS)
121
134
135
+ #define SUNIV_NDMA_NR_MAX_CHANNELS 4
136
+ #define SUNIV_DDMA_NR_MAX_CHANNELS 4
137
+ #define SUNIV_NDMA_NR_MAX_VCHANS (24 * 2 - 1)
138
+ #define SUNIV_DDMA_NR_MAX_VCHANS 10
139
+
122
140
/* This set of SUN4I_DDMA timing parameters were found experimentally while
123
141
* working with the SPI driver and seem to make it behave correctly */
124
142
#define SUN4I_DDMA_MAGIC_SPI_PARAMETERS \
@@ -243,6 +261,16 @@ static void set_src_data_width_a10(u32 *p_cfg, s8 data_width)
243
261
* p_cfg |= SUN4I_DMA_CFG_SRC_DATA_WIDTH (data_width );
244
262
}
245
263
264
+ static void set_dst_data_width_f1c100s (u32 * p_cfg , s8 data_width )
265
+ {
266
+ * p_cfg |= SUNIV_DMA_CFG_DST_DATA_WIDTH (data_width );
267
+ }
268
+
269
+ static void set_src_data_width_f1c100s (u32 * p_cfg , s8 data_width )
270
+ {
271
+ * p_cfg |= SUNIV_DMA_CFG_SRC_DATA_WIDTH (data_width );
272
+ }
273
+
246
274
static int convert_burst_a10 (u32 maxburst )
247
275
{
248
276
if (maxburst > 8 )
@@ -252,6 +280,15 @@ static int convert_burst_a10(u32 maxburst)
252
280
return (maxburst >> 2 );
253
281
}
254
282
283
+ static int convert_burst_f1c100s (u32 maxburst )
284
+ {
285
+ if (maxburst > 4 )
286
+ return - EINVAL ;
287
+
288
+ /* 1 -> 0, 4 -> 1 */
289
+ return (maxburst >> 2 );
290
+ }
291
+
255
292
static int convert_buswidth (enum dma_slave_buswidth addr_width )
256
293
{
257
294
if (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES )
@@ -1368,8 +1405,31 @@ static struct sun4i_dma_config sun4i_a10_dma_cfg = {
1368
1405
.has_reset = false,
1369
1406
};
1370
1407
1408
+ static struct sun4i_dma_config suniv_f1c100s_dma_cfg = {
1409
+ .ndma_nr_max_channels = SUNIV_NDMA_NR_MAX_CHANNELS ,
1410
+ .ndma_nr_max_vchans = SUNIV_NDMA_NR_MAX_VCHANS ,
1411
+
1412
+ .ddma_nr_max_channels = SUNIV_DDMA_NR_MAX_CHANNELS ,
1413
+ .ddma_nr_max_vchans = SUNIV_DDMA_NR_MAX_VCHANS ,
1414
+
1415
+ .dma_nr_max_channels = SUNIV_NDMA_NR_MAX_CHANNELS +
1416
+ SUNIV_DDMA_NR_MAX_CHANNELS ,
1417
+
1418
+ .set_dst_data_width = set_dst_data_width_f1c100s ,
1419
+ .set_src_data_width = set_src_data_width_f1c100s ,
1420
+ .convert_burst = convert_burst_f1c100s ,
1421
+
1422
+ .ndma_drq_sdram = SUNIV_NDMA_DRQ_TYPE_SDRAM ,
1423
+ .ddma_drq_sdram = SUNIV_DDMA_DRQ_TYPE_SDRAM ,
1424
+
1425
+ .max_burst = SUNIV_MAX_BURST ,
1426
+ .has_reset = true,
1427
+ };
1428
+
1371
1429
static const struct of_device_id sun4i_dma_match [] = {
1372
1430
{ .compatible = "allwinner,sun4i-a10-dma" , .data = & sun4i_a10_dma_cfg },
1431
+ { .compatible = "allwinner,suniv-f1c100s-dma" ,
1432
+ .data = & suniv_f1c100s_dma_cfg },
1373
1433
{ /* sentinel */ },
1374
1434
};
1375
1435
MODULE_DEVICE_TABLE (of , sun4i_dma_match );
0 commit comments