@@ -100,6 +100,22 @@ static irqreturn_t fsl_edma_irq_handler(int irq, void *dev_id)
100
100
return fsl_edma_err_handler (irq , dev_id );
101
101
}
102
102
103
+ static bool fsl_edma_srcid_in_use (struct fsl_edma_engine * fsl_edma , u32 srcid )
104
+ {
105
+ struct fsl_edma_chan * fsl_chan ;
106
+ int i ;
107
+
108
+ for (i = 0 ; i < fsl_edma -> n_chans ; i ++ ) {
109
+ fsl_chan = & fsl_edma -> chans [i ];
110
+
111
+ if (fsl_chan -> srcid && srcid == fsl_chan -> srcid ) {
112
+ dev_err (& fsl_chan -> pdev -> dev , "The srcid is in use, can't use!" );
113
+ return true;
114
+ }
115
+ }
116
+ return false;
117
+ }
118
+
103
119
static struct dma_chan * fsl_edma_xlate (struct of_phandle_args * dma_spec ,
104
120
struct of_dma * ofdma )
105
121
{
@@ -117,6 +133,10 @@ static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec,
117
133
list_for_each_entry_safe (chan , _chan , & fsl_edma -> dma_dev .channels , device_node ) {
118
134
if (chan -> client_count )
119
135
continue ;
136
+
137
+ if (fsl_edma_srcid_in_use (fsl_edma , dma_spec -> args [1 ]))
138
+ return NULL ;
139
+
120
140
if ((chan -> chan_id / chans_per_mux ) == dma_spec -> args [0 ]) {
121
141
chan = dma_get_slave_channel (chan );
122
142
if (chan ) {
@@ -161,6 +181,8 @@ static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec,
161
181
continue ;
162
182
163
183
fsl_chan = to_fsl_edma_chan (chan );
184
+ if (fsl_edma_srcid_in_use (fsl_edma , dma_spec -> args [0 ]))
185
+ return NULL ;
164
186
i = fsl_chan - fsl_edma -> chans ;
165
187
166
188
fsl_chan -> priority = dma_spec -> args [1 ];
0 commit comments