Re: [RESEND PATCH v3 5/8] mtd: spi-nor: cadence-quadspi: Handle probe deferral while requesting DMA channel

From: Vignesh Raghavendra
Date: Thu Aug 27 2020 - 03:04:54 EST




On 8/26/20 7:01 PM, Jan Kiszka wrote:
> On 26.08.20 14:18, Vignesh Raghavendra wrote:
>> On 8/26/20 3:42 PM, Jan Kiszka wrote:
>>> On 24.08.20 19:20, Jan Kiszka wrote:
>>>> On 24.08.20 14:49, Jan Kiszka wrote:
>>>>> On 24.08.20 13:45, Vignesh Raghavendra wrote:
>>>>>>
[...]
>> Also, there seems to be DMA mapping related issue, that was always present in
>> older driver as well. Could you see if diff [2] fixes the issue?
>>
>> [2] Use DMA device for mapping:
>>
>> ---><8---
>>
>>
>> diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
>> index b9739ae919340..a546aa4598758 100644
>> --- a/drivers/spi/spi-cadence-quadspi.c
>> +++ b/drivers/spi/spi-cadence-quadspi.c
>> @@ -901,6 +901,7 @@ static int cqspi_direct_read_execute(struct cqspi_flash_pdata *f_pdata,
>> {
>> struct cqspi_st *cqspi = f_pdata->cqspi;
>> struct device *dev = &cqspi->pdev->dev;
>> + struct device *ddev = cqspi->rx_chan->device->dev;
>> enum dma_ctrl_flags flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
>> dma_addr_t dma_src = (dma_addr_t)cqspi->mmap_phys_base + from;
>> int ret = 0;
>> @@ -917,8 +918,8 @@ static int cqspi_direct_read_execute(struct cqspi_flash_pdata *f_pdata,
>> return 0;
>> }
>>
>> - dma_dst = dma_map_single(dev, buf, len, DMA_FROM_DEVICE);
>> - if (dma_mapping_error(dev, dma_dst)) {
>> + dma_dst = dma_map_single(ddev, buf, len, DMA_FROM_DEVICE);
>> + if (dma_mapping_error(ddev, dma_dst)) {
>> dev_err(dev, "dma mapping failed\n");
>> return -ENOMEM;
>> }
>> @@ -952,7 +953,7 @@ static int cqspi_direct_read_execute(struct cqspi_flash_pdata *f_pdata,
>> }
>>
>> err_unmap:
>> - dma_unmap_single(dev, dma_dst, len, DMA_FROM_DEVICE);
>> + dma_unmap_single(ddev, dma_dst, len, DMA_FROM_DEVICE);
>>
>> return ret;
>> }
>>
>
> That seems to help! Wasn't able to reproduce the issue with this applied
> so far.
>

OK, great... I will post this patch soon once I finish a bit more
testing... Thanks!


Regards
Vignesh