Commit eca2978c authored by Federico Vaga's avatar Federico Vaga

sw:drv: limit DMA segment size to the maximum supported by the system

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent e608461a
......@@ -48,6 +48,7 @@ static int sg_alloc_table_from_pages_no_squash(struct sg_table *sgt,
unsigned int n_pages,
unsigned int offset,
unsigned long size,
unsigned int max_segment,
gfp_t gfp_mask)
{
struct scatterlist *sg;
......@@ -510,7 +511,7 @@ int fa_probe(struct platform_device *pdev)
case ADC_VER_SPEC:
memops.read = ioread32;
memops.write = iowrite32;
fa->sg_alloc_table_from_pages = sg_alloc_table_from_pages;
fa->sg_alloc_table_from_pages = __sg_alloc_table_from_pages;
break;
case ADC_VER_SVEC:
memops.read = ioread32be;
......
......@@ -306,6 +306,7 @@ static int zfad_dma_prep_slave_sg(struct dma_chan *dchan,
struct dma_async_tx_descriptor *tx;
struct page **pages;
unsigned int nr_pages, sg_mapped;
size_t max_segment_size;
int err;
/* prepare the context for the block transfer */
......@@ -323,9 +324,11 @@ static int zfad_dma_prep_slave_sg(struct dma_chan *dchan,
goto err_to_pages;
/* With some version we cannot use the version from the Linux kernel */
max_segment_size = dma_get_max_seg_size(dchan->device->dev);
fa->sg_alloc_table_from_pages(&zfad_block->sgt, pages, nr_pages,
offset_in_page(zfad_block->block->data),
zfad_block->block->datalen, GFP_KERNEL);
zfad_block->block->datalen,
max_segment_size, GFP_KERNEL);
if (unlikely(err))
goto err_sgt;
......
......@@ -451,6 +451,7 @@ struct fa_dev {
unsigned int n_pages,
unsigned int offset,
unsigned long size,
unsigned int max_segment,
gfp_t gfp_mask);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment