@@ -1157,15 +1157,19 @@ static void stm32_spi_dma_rx_cb(void *data)
1157
1157
* stm32_spi_dma_config - configure dma slave channel depending on current
1158
1158
* transfer bits_per_word.
1159
1159
* @spi: pointer to the spi controller data structure
1160
+ * @dma_chan: pointer to the DMA channel
1160
1161
* @dma_conf: pointer to the dma_slave_config structure
1161
1162
* @dir: direction of the dma transfer
1162
1163
*/
1163
1164
static void stm32_spi_dma_config (struct stm32_spi * spi ,
1165
+ struct dma_chan * dma_chan ,
1164
1166
struct dma_slave_config * dma_conf ,
1165
1167
enum dma_transfer_direction dir )
1166
1168
{
1167
1169
enum dma_slave_buswidth buswidth ;
1170
+ struct dma_slave_caps caps ;
1168
1171
u32 maxburst ;
1172
+ int ret ;
1169
1173
1170
1174
if (spi -> cur_bpw <= 8 )
1171
1175
buswidth = DMA_SLAVE_BUSWIDTH_1_BYTE ;
@@ -1184,6 +1188,11 @@ static void stm32_spi_dma_config(struct stm32_spi *spi,
1184
1188
maxburst = 1 ;
1185
1189
}
1186
1190
1191
+ /* Get the DMA channel caps, and adjust maxburst if possible */
1192
+ ret = dma_get_slave_caps (dma_chan , & caps );
1193
+ if (!ret )
1194
+ maxburst = min (maxburst , caps .max_burst );
1195
+
1187
1196
memset (dma_conf , 0 , sizeof (struct dma_slave_config ));
1188
1197
dma_conf -> direction = dir ;
1189
1198
if (dma_conf -> direction == DMA_DEV_TO_MEM ) { /* RX */
@@ -1366,7 +1375,7 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
1366
1375
1367
1376
rx_dma_desc = NULL ;
1368
1377
if (spi -> rx_buf && spi -> dma_rx ) {
1369
- stm32_spi_dma_config (spi , & rx_dma_conf , DMA_DEV_TO_MEM );
1378
+ stm32_spi_dma_config (spi , spi -> dma_rx , & rx_dma_conf , DMA_DEV_TO_MEM );
1370
1379
dmaengine_slave_config (spi -> dma_rx , & rx_dma_conf );
1371
1380
1372
1381
/* Enable Rx DMA request */
@@ -1382,7 +1391,7 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
1382
1391
1383
1392
tx_dma_desc = NULL ;
1384
1393
if (spi -> tx_buf && spi -> dma_tx ) {
1385
- stm32_spi_dma_config (spi , & tx_dma_conf , DMA_MEM_TO_DEV );
1394
+ stm32_spi_dma_config (spi , spi -> dma_tx , & tx_dma_conf , DMA_MEM_TO_DEV );
1386
1395
dmaengine_slave_config (spi -> dma_tx , & tx_dma_conf );
1387
1396
1388
1397
tx_dma_desc = dmaengine_prep_slave_sg (
0 commit comments