From patchwork Thu Feb 23 18:01:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frode Isaksen X-Patchwork-Id: 9588749 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 4950060210 for ; Thu, 23 Feb 2017 18:03:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E36228788 for ; Thu, 23 Feb 2017 18:03:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3307928793; Thu, 23 Feb 2017 18:03:03 +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 CAD0528788 for ; Thu, 23 Feb 2017 18:03:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751228AbdBWSDC (ORCPT ); Thu, 23 Feb 2017 13:03:02 -0500 Received: from mail-wr0-f181.google.com ([209.85.128.181]:32861 "EHLO mail-wr0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751049AbdBWSDC (ORCPT ); Thu, 23 Feb 2017 13:03:02 -0500 Received: by mail-wr0-f181.google.com with SMTP id 97so26675004wrb.0 for ; Thu, 23 Feb 2017 10:03:01 -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=xymqxQfMpXoDpL8VjPHKR4e+DmP5Ui5irzVAW4VK5eY=; b=fF1OAOkm4Gh6LIpXBIOwOA7Qmh+NOhboNRfBXhYt+6CtCiYmUwNQN5mpKnNGbp1OWb q4JKFSjFBqWNjbc1CYC+oZILLlY1ml6N4BEla2oe8xK978CsfUQp2KzEepgo9tUnotzL wvJFyMsinmHnglXmFPBxoSrQwFmS7eKRX0PhdzKtp72+Bz9SCxuOpsdCgoNOhikFxfjN L4wRtsdR/jlbjlHjIhNgbg/kFxPmxY2t206/rTMfxpdle3X0JVUE/8B8VnYzc7W6EMfk lA9qJRzBK4DStXz+nmmTT6CVUJd7JUQx0+5vzXTbnFV6oGJQoLdNm9tJYbQoDxsy/Pvc SO5g== 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=xymqxQfMpXoDpL8VjPHKR4e+DmP5Ui5irzVAW4VK5eY=; b=JQwAcoIZgVEQg9CWwsSZTGMMK5W7UmqAtc1kOQSj5v52HkjRTHK1Pjo+PuojgNWzSK V9eUDjxjnmavTnw+ClOkmYe85VBENlmvTOr23Id3PgVB1qhMXs7ujz1wX/cWx7yqQ0BN Ca+Ot9BpKbD6K7v60lFdqnHJDXNunnZ4CQ1c/vabxNC4HVwosq5Qk45nvGMieAKOyRfa vJSYTp9wNHCF02YjLXJSWicxrFxJ/Hdx6mqVuJIoFEBI9hHTCui5usCaUBM2ftKN/WG8 xDVi69FIDZXImS+K+xato5A5wDwy8OVLeKaNtZ4A0riw/SloafLyjk4JIjyiUcwfTyBv R26g== X-Gm-Message-State: AMke39kf+W83qH9GbUcqwCFX0FlZQy09nbMLrPO/HpdtPGVwTbXcfnhIeKsbBArIqSr1gpbL X-Received: by 10.223.143.35 with SMTP id p32mr12664333wrb.120.1487872980424; Thu, 23 Feb 2017 10:03:00 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z134sm7739182wmc.20.2017.02.23.10.02.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Feb 2017 10:02:59 -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 v3 2/6] spi: davinci: enable DMA when channels are defined in DT Date: Thu, 23 Feb 2017 19:01:57 +0100 Message-Id: <1487872921-26628-3-git-send-email-fisaksen@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487872921-26628-1-git-send-email-fisaksen@baylibre.com> References: <1487872921-26628-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 164cc71..1e24395 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;