From patchwork Fri Jan 6 03:26:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 9499957 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AC8E8606DE for ; Fri, 6 Jan 2017 03:43:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96B382840A for ; Fri, 6 Jan 2017 03:43:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 883F628456; Fri, 6 Jan 2017 03:43:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 23DB92840A for ; Fri, 6 Jan 2017 03:43:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cPLRK-0005Kc-Gv; Fri, 06 Jan 2017 03:43:38 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cPLRG-0005DV-QU for linux-arm-kernel@bombadil.infradead.org; Fri, 06 Jan 2017 03:43:35 +0000 Received: from vern.gendns.com ([206.190.152.46]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cPLEC-0007Df-Do for linux-arm-kernel@lists.infradead.org; Fri, 06 Jan 2017 03:30:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Sze3Iv0WJF0k7XUafeMTYcwGwts4ReDFjTfRR5tYP14=; b=JNoD4p/VpufE5xUT08nBYQ07Nb mn5JqsvU4gO6ivBvzTSaHN36ImBYjQNuiWJ/Bk1KcXjP9HOSQg4QZ8O9zYmZcMtnyzOUy0OUFTmld lphx8V03SMko2f8A9BmNk4pqWxz1o/Ajcszdk4Gixc5UVw5D+lbbKerQ/lMUkxLI1dT/Aupudh9eA VqYYERPYc6PNoxc/t0qjpk0HIFSozByBG2vBtbEY4C2MCgws5I75QGgFE5gVH+0cJvj7NEq3MM1wp hPzPKwiw+5aM9TaXRHY2/ID61ALKr/NLjkdIABAWH8LQri16qlr+gnuGfe6oTXAhTOVw8uYWeC5it LfaG1/kg==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:48370 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.87) (envelope-from ) id 1cPLAo-000PpF-Hi; Thu, 05 Jan 2017 22:26:35 -0500 From: David Lechner To: Mark Brown Subject: [RESEND] spi: davinci: Allow device tree devices to use DMA Date: Thu, 5 Jan 2017 21:26:17 -0600 Message-Id: <1483673177-31516-1-git-send-email-david@lechnology.com> X-Mailer: git-send-email 2.7.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170106_033004_597018_EF471ACA X-CRM114-Status: GOOD ( 15.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Lechner , khilman@kernel.org, nsekhar@ti.com, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This allows SPI devices specified in a device tree to use DMA when the master controller. Since device tree is supposed to only describe the hardware, adding such a configuration option to device tree would not be acceptable. So, this is the best we can do for now to get SPI devices working with DMA. Unfortunately, this excludes the possibility of using one SPI device with DMA and one without on the same master. Signed-off-by: David Lechner --- When I originally submitted this patch, there was some discussion as to whether dspi->dma_rx should be changed to return an error rather than being null. However, I prefer it the way it is and don't see a compelling reason to change it. drivers/spi/spi-davinci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index d36c11b..c6cf73a 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -388,6 +388,7 @@ static int davinci_spi_setup_transfer(struct spi_device *spi, static int davinci_spi_of_setup(struct spi_device *spi) { struct davinci_spi_config *spicfg = spi->controller_data; + struct davinci_spi *dspi = spi_master_get_devdata(spi->master); struct device_node *np = spi->dev.of_node; u32 prop; @@ -400,6 +401,9 @@ static int davinci_spi_of_setup(struct spi_device *spi) if (!of_property_read_u32(np, "ti,spi-wdelay", &prop)) spicfg->wdelay = (u8)prop; spi->controller_data = spicfg; + /* Use DMA for device if master supports it */ + if (dspi->dma_rx) + spicfg->io_type = SPI_IO_TYPE_DMA; } return 0;