@@ -184,7 +184,7 @@ static void vc_dmaman_init(struct vc_dmaman *dmaman, void __iomem *dma_base,
184
184
}
185
185
186
186
static int vc_dmaman_chan_alloc (struct vc_dmaman * dmaman ,
187
- unsigned preferred_feature_set )
187
+ unsigned required_feature_set )
188
188
{
189
189
u32 chans ;
190
190
int chan = 0 ;
@@ -193,10 +193,8 @@ static int vc_dmaman_chan_alloc(struct vc_dmaman *dmaman,
193
193
chans = dmaman -> chan_available ;
194
194
for (feature = 0 ; feature < BCM_DMA_FEATURE_COUNT ; feature ++ )
195
195
/* select the subset of available channels with the desired
196
- feature so long as some of the candidate channels have that
197
- feature */
198
- if ((preferred_feature_set & (1 << feature )) &&
199
- (chans & dmaman -> has_feature [feature ]))
196
+ features */
197
+ if (required_feature_set & (1 << feature ))
200
198
chans &= dmaman -> has_feature [feature ];
201
199
202
200
if (!chans )
@@ -228,7 +226,7 @@ static int vc_dmaman_chan_free(struct vc_dmaman *dmaman, int chan)
228
226
229
227
/* DMA Manager Monitor */
230
228
231
- extern int bcm_dma_chan_alloc (unsigned preferred_feature_set ,
229
+ extern int bcm_dma_chan_alloc (unsigned required_feature_set ,
232
230
void __iomem * * out_dma_base , int * out_dma_irq )
233
231
{
234
232
struct vc_dmaman * dmaman = g_dmaman ;
@@ -240,7 +238,7 @@ extern int bcm_dma_chan_alloc(unsigned preferred_feature_set,
240
238
return - ENODEV ;
241
239
242
240
mutex_lock (& dmaman -> lock );
243
- chan = vc_dmaman_chan_alloc (dmaman , preferred_feature_set );
241
+ chan = vc_dmaman_chan_alloc (dmaman , required_feature_set );
244
242
if (chan < 0 )
245
243
goto out ;
246
244
@@ -442,6 +440,7 @@ static inline struct bcm2835_desc *to_bcm2835_dma_desc(
442
440
return container_of (t , struct bcm2835_desc , vd .tx );
443
441
}
444
442
443
+ #if 0
445
444
static void dma_dumpregs (struct bcm2835_chan * c )
446
445
{
447
446
pr_debug ("-------------DMA DUMPREGS-------------\n" );
@@ -457,6 +456,7 @@ static void dma_dumpregs(struct bcm2835_chan *c)
457
456
readl (c -> chan_base + BCM2835_DMA_NEXTCB ));
458
457
pr_debug ("--------------------------------------\n" );
459
458
}
459
+ #endif
460
460
461
461
static void bcm2835_dma_desc_free (struct virt_dma_desc * vd )
462
462
{
@@ -862,6 +862,7 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_slave_sg(
862
862
uint32_t len = sg_dma_len (sgent );
863
863
864
864
for (j = 0 ; j < len ; j += max_size ) {
865
+ u32 waits ;
865
866
struct bcm2835_dma_cb * control_block =
866
867
& d -> control_block_base [i + splitct ];
867
868
@@ -879,7 +880,7 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_slave_sg(
879
880
}
880
881
881
882
/* Common part */
882
- u32 waits = SDHCI_BCM_DMA_WAITS ;
883
+ waits = SDHCI_BCM_DMA_WAITS ;
883
884
if ((dma_debug >> 0 ) & 0x1f )
884
885
waits = (dma_debug >> 0 ) & 0x1f ;
885
886
control_block -> info |= BCM2835_DMA_WAITS (waits );
@@ -1074,6 +1075,14 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
1074
1075
int rc ;
1075
1076
int i ;
1076
1077
int irq ;
1078
+ #ifdef CONFIG_DMA_BCM2708_LEGACY
1079
+ static const u32 wanted_features [] = {
1080
+ BCM_DMA_FEATURE_FAST ,
1081
+ BCM_DMA_FEATURE_NORMAL ,
1082
+ BCM_DMA_FEATURE_LITE
1083
+ };
1084
+ int j ;
1085
+ #endif
1077
1086
1078
1087
1079
1088
if (!pdev -> dev .dma_mask )
@@ -1120,20 +1129,24 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
1120
1129
1121
1130
platform_set_drvdata (pdev , od );
1122
1131
1123
- for (i = 0 ; i < 5 ; i ++ ) {
1132
+ for (i = 0 , j = 0 ; j < ARRAY_SIZE (wanted_features );) {
1133
+
1124
1134
void __iomem * chan_base ;
1125
1135
int chan_id ;
1126
1136
1127
- chan_id = bcm_dma_chan_alloc (BCM_DMA_FEATURE_LITE ,
1128
- & chan_base ,
1129
- & irq );
1137
+ chan_id = bcm_dma_chan_alloc (wanted_features [ j ] ,
1138
+ & chan_base ,
1139
+ & irq );
1130
1140
1131
- if (chan_id < 0 )
1132
- break ;
1141
+ if (chan_id < 0 ) {
1142
+ j ++ ;
1143
+ continue ;
1144
+ }
1133
1145
1134
1146
rc = bcm2708_dma_chan_init (od , chan_base , chan_id , irq );
1135
1147
if (rc )
1136
1148
goto err_no_dma ;
1149
+ i ++ ;
1137
1150
}
1138
1151
1139
1152
if (pdev -> dev .of_node ) {
@@ -1146,6 +1159,8 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
1146
1159
}
1147
1160
}
1148
1161
1162
+ dev_info (& pdev -> dev , "Initialized %i DMA channels (+ 1 legacy)\n" , i );
1163
+
1149
1164
#else
1150
1165
rc = dma_set_mask_and_coherent (& pdev -> dev , DMA_BIT_MASK (32 ));
1151
1166
if (rc )
0 commit comments