Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753437AbbEHL0u (ORCPT ); Fri, 8 May 2015 07:26:50 -0400 Received: from mail1.bemta5.messagelabs.com ([195.245.231.152]:37143 "EHLO mail1.bemta5.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752840AbbEHL0n (ORCPT ); Fri, 8 May 2015 07:26:43 -0400 X-Greylist: delayed 388 seconds by postgrey-1.27 at vger.kernel.org; Fri, 08 May 2015 07:26:42 EDT X-Env-Sender: jonathan@raspberrypi.org X-Msg-Ref: server-4.tower-90.messagelabs.com!1431084005!1150277!1 X-Originating-IP: [217.28.140.9] X-StarScan-Received: X-StarScan-Version: 6.13.14; banners=-,-,- X-VirusChecked: Checked Message-ID: <554C9BE0.60205@raspberrypi.org> Date: Fri, 8 May 2015 12:20:00 +0100 From: Jonathan Bell User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: =?UTF-8?B?Tm9yYWxmIFRyw7hubmVz?= , Martin Sperl , Stephen Warren CC: , , Linux Kernel Mailing List , linux-rpi-kernel , , linux-spi Subject: Re: [PATCH v2] dmaengine: bcm2835: Add slave dma support References: <1429355160-13657-1-git-send-email-noralf@tronnes.org> <554A69D5.90301@tronnes.org> In-Reply-To: <554A69D5.90301@tronnes.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [86.129.220.154] X-ClientProxiedBy: THHSTE15FE06.hs20.net (192.168.251.46) To thhste15d1be5.hs20.net (192.168.251.26) X-EXCLAIMER-MD-CONFIG: 266e7a57-cddd-49fd-bdea-19bca6d40303 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2684 Lines: 74 On 06/05/2015 20:21, Noralf Trønnes wrote: > > Den 01.05.2015 23:07, skrev Martin Sperl: >> Tests with the initial (and incomplete) version of the spi-bcm2835 >> driver >> with DMA transfer support show that the dma-engine works as expected >> with >> this patch. >> >> There is one one observation: >> >>> On 18.04.2015, at 13:06, Noralf Trønnes wrote: >>> +static struct dma_async_tx_descriptor * >>> +bcm2835_dma_prep_slave_sg(struct dma_chan *chan, >>> + struct scatterlist *sgl, >>> + unsigned int sg_len, >>> + enum dma_transfer_direction direction, >>> + unsigned long flags, void *context) >>> +{ >> ... >>> + /* Enable */ >>> + if (i == sg_len - 1 && len - j <= max_size) >>> + control_block->info |= BCM2835_DMA_INT_EN; >> The observation is that an interrupt is always triggered - even in >> the case >> where flags does NOT have DMA_PREP_INTERRUPT set. >> This may not be necessary and avoid interrupts. >> >> So maybe the above if clause should get extended by: >> && (flags & DMA_PREP_INTERRUPT) >> to only trigger an interrupt when really requested. >> >> I am not sure if there are any side-effects because of this besides >> having the >> requirement on the client to run dmaengine_terminate_all() on that >> specific dma >> channel without interrupts when the transfer is finished. >> >> In the case of SPI we have TX feed the fifo - which finishes early - >> , but we >> only need to the interrupt when RX finishes reading the fifo, which >> indicates >> that the SPI-transfer is fully finished. >> So having an interrupt on TX is not necessary for the process. >> >> The same observations may also apply to bcm2835_dma_prep_dma_cyclic >> (which is >> outside of this patch provided by Noralf). > > Jonathan, can you comment on this? > > > Noralf. > > I agree that the interrupt generated would be spurious - in the case where it is not required. However if you do && (flags & DMA_PREP_INTERRUPT) then all users of this driver need to explicitly set interrupt flags when doing a scatter-gather transfer. As I understand it, currently the only upstream client of this driver is the I2S driver which only uses cyclic anyway. Not requiring an interrupt on completion is a bit of an edge case - the default among other dmaengine drivers appears to be to enable interrupts unconditionally. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/