@@ -30,6 +30,14 @@ int falcon_wait_idle(struct falcon *falcon)
30
30
(value == 0 ), 10 , 100000 );
31
31
}
32
32
33
+ static int falcon_dma_wait_not_full (struct falcon * falcon )
34
+ {
35
+ u32 value ;
36
+
37
+ return readl_poll_timeout (falcon -> regs + FALCON_DMATRFCMD , value ,
38
+ !(value & FALCON_DMATRFCMD_FULL ), 10 , 100000 );
39
+ }
40
+
33
41
static int falcon_dma_wait_idle (struct falcon * falcon )
34
42
{
35
43
u32 value ;
@@ -44,6 +52,7 @@ static int falcon_copy_chunk(struct falcon *falcon,
44
52
enum falcon_memory target )
45
53
{
46
54
u32 cmd = FALCON_DMATRFCMD_SIZE_256B ;
55
+ int err ;
47
56
48
57
if (target == FALCON_MEMORY_IMEM )
49
58
cmd |= FALCON_DMATRFCMD_IMEM ;
@@ -56,11 +65,15 @@ static int falcon_copy_chunk(struct falcon *falcon,
56
65
*/
57
66
cmd |= FALCON_DMATRFCMD_DMACTX (1 );
58
67
68
+ err = falcon_dma_wait_not_full (falcon );
69
+ if (err < 0 )
70
+ return err ;
71
+
59
72
falcon_writel (falcon , offset , FALCON_DMATRFMOFFS );
60
73
falcon_writel (falcon , base , FALCON_DMATRFFBOFFS );
61
74
falcon_writel (falcon , cmd , FALCON_DMATRFCMD );
62
75
63
- return falcon_dma_wait_idle ( falcon ) ;
76
+ return 0 ;
64
77
}
65
78
66
79
static void falcon_copy_firmware_image (struct falcon * falcon ,
@@ -191,6 +204,11 @@ int falcon_boot(struct falcon *falcon)
191
204
falcon_copy_chunk (falcon , falcon -> firmware .code .offset + offset ,
192
205
offset , FALCON_MEMORY_IMEM );
193
206
207
+ /* wait for DMA to complete */
208
+ err = falcon_dma_wait_idle (falcon );
209
+ if (err < 0 )
210
+ return err ;
211
+
194
212
/* setup falcon interrupts */
195
213
falcon_writel (falcon , FALCON_IRQMSET_EXT (0xff ) |
196
214
FALCON_IRQMSET_SWGEN1 |
0 commit comments