From patchwork Fri Feb 17 10:38:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frode Isaksen X-Patchwork-Id: 9579549 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 A6F8560586 for ; Fri, 17 Feb 2017 10:38:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91B07280B0 for ; Fri, 17 Feb 2017 10:38:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82FDD2866B; Fri, 17 Feb 2017 10:38:40 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B9D72815E for ; Fri, 17 Feb 2017 10:38:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932269AbdBQKij (ORCPT ); Fri, 17 Feb 2017 05:38:39 -0500 Received: from mail-wr0-f176.google.com ([209.85.128.176]:34738 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932556AbdBQKii (ORCPT ); Fri, 17 Feb 2017 05:38:38 -0500 Received: by mail-wr0-f176.google.com with SMTP id z61so27422409wrc.1 for ; Fri, 17 Feb 2017 02:38:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Jj6CgmlZPKIySXOlJyWllS3kxTv3vGOtVHcISNmEwK4=; b=nSyfTMtVrPTC3kk/gxF15a2I0B2oR8P8ZOEBHk36grfzAlYnyTMZq9IXRDYM4AzoaU SZiHF53CiYLhsXLp7D6pfKH7qksjuxxpkA8FDedPR3pf/Eg8RsatrjE1WFcLqNV2Ow1H vWrOYGvTmRcrJaQdJq2qiX2eNlvzHVZ3/rm4JvwPjb7O9GstU6AOmACODYSqIQ+cjOVY EIxZAmXhJV5FG7zWlPV4n0E6KgTpG9E8pOJPc1Ai3cy4HkKu453FwQgN0ysx4YjA25Yo a5l18YHfgyOl3iZ/vZwqwqEMoeV+Rman6c00g5nLegd9qyCeKOxWs3pa5flf7qK8CzGf AYeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Jj6CgmlZPKIySXOlJyWllS3kxTv3vGOtVHcISNmEwK4=; b=JfSsGmR2WVObqOAsBk0yqCbscCFvYuYcFW16PQCIX8ZVtdj3yftEHXO29MF7nwHltq mGscVq5xstrRP8Hezmf4n3LRM5sWIDfXDcijQo7RhKPdZPBGtuMzT+bmjBmLB3mSp0ab 5K+iptvpOtM+mqNzttbJIuHfC/h9KjAD5R5mdYlIyeZnMx/MfnJu9KOJJRnnrF8Exk4M uFKkLkEfws/HRs2QHiQgai1UqoVGBNuwBeyzoHlfvmxnLWlj694sbyfxRrp9YjOZ2aM2 ekd5+KABFPYuVCCn0IAY7DEs9v7mMKv5nPik37WOBFcZJ6xh/zXgBU+YW4Zj0aZkfSvx DLTw== X-Gm-Message-State: AMke39kK43CshtlCS7BFDDiVk7sjBTW6WYJv0MxVGyFlCCoPXH9xoze+NN+zPjxu4rtCOv6n X-Received: by 10.223.133.164 with SMTP id 33mr6134132wrt.39.1487327917379; Fri, 17 Feb 2017 02:38:37 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id y80sm12531459wrb.12.2017.02.17.02.38.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 02:38:36 -0800 (PST) From: Frode Isaksen To: nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, linux-arm-kernel@lists.infradead.org Cc: broonie@kernel.org, linux-spi@vger.kernel.org, Fabien Parent , Frode Isaksen Subject: [PATCH v2 2/6] spi: davinci: enable DMA when channels are defined in DT Date: Fri, 17 Feb 2017 11:38:20 +0100 Message-Id: <1487327904-28311-3-git-send-email-fisaksen@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487327904-28311-1-git-send-email-fisaksen@baylibre.com> References: <1487327904-28311-1-git-send-email-fisaksen@baylibre.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabien Parent When booting with DT the SPI driver is always using the SPI_IO_TYPE_INTR mode to transfer data even if DMA channels are defined in the DT. This commit changes the behaviour to select the SPI_IO_TYPE_DMA mode if DMA channels are defined in the DT and will keep SPI_IO_TYPE_INTR if the channels are not defined in it. Signed-off-by: Fabien Parent Signed-off-by: Frode Isaksen --- 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 5b164e5..9823908 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -389,6 +389,7 @@ static int davinci_spi_of_setup(struct spi_device *spi) { struct davinci_spi_config *spicfg = spi->controller_data; struct device_node *np = spi->dev.of_node; + struct davinci_spi *dspi = spi_master_get_devdata(spi->master); u32 prop; if (spicfg == NULL && np) { @@ -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; + + if (dspi->dma_rx && dspi->dma_tx) + spicfg->io_type = SPI_IO_TYPE_DMA; } return 0;