From patchwork Mon Feb 6 14:57:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Parent X-Patchwork-Id: 9558167 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 CE06F604E0 for ; Mon, 6 Feb 2017 14:57:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE4D727F93 for ; Mon, 6 Feb 2017 14:57:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2F2B27F9F; Mon, 6 Feb 2017 14:57:15 +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 597B927F93 for ; Mon, 6 Feb 2017 14:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751977AbdBFO5P (ORCPT ); Mon, 6 Feb 2017 09:57:15 -0500 Received: from mail-wr0-f176.google.com ([209.85.128.176]:34954 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751980AbdBFO5O (ORCPT ); Mon, 6 Feb 2017 09:57:14 -0500 Received: by mail-wr0-f176.google.com with SMTP id 89so23563785wrr.2 for ; Mon, 06 Feb 2017 06:57:13 -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=uDk0yg5R1qx4fT1RYlyEkj6ZNbdn2tw0EHfa8hM+fOg=; b=QiI493fBLKO3kjAzgN/StB+7kp6PmBTDIvMKkm7zmSwnc+bPusocm+83yUFMZLLW6i cg8HiPnXXwCNCMFWICRowRTRs7DBfunnriFCaQn5ati8Px9RsGdEEexlsV1DtQx7Jb+G ooaoueTOJMUAFnePsAsI+TumJn0WQG2VGjCJcru55RgXi3njHnULPNgDODE/+bxQmi8w 4nvODdcpUgHzsm+k0RAPhEuzvZXtDs3Rc6rj3K+cqxt+ZQLtGqhQDgXyetUj7wUMUne6 xdqVb3kb25xC8UU4LfI1asYYAV+ReMAr0hbE/KK0rZ/PI74V3wknxzaMYLb7mvhI1l7O oOZQ== 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=uDk0yg5R1qx4fT1RYlyEkj6ZNbdn2tw0EHfa8hM+fOg=; b=X9VN5uNA/Wy15WT9GbJizSGzLZYck+4eyJah4mFvGIhP6UZT2sFV/fpEo61n/1c2bJ LfuvFaJCYU/kS3do3z6OCM5i/7/sgAmFJJhA393MRZx6DBocrdMxSIv8pGVp2rzmVohv S6bqPpxJipyu2On1EDPEvv7KocFOQhtXIut0CiCG3fbbfP2dR89Xg8abMH2V847LbuDK 6HhgO/hQktZZdPziLbe3I9aDTWrTFI36tOmqEkLcuuOlUegJHiHBplkXZsFcPbBb0cwW VksqcuomA7LdXDtBzayiLGV276fzt4aEjn57GNyrzNlbduvBZ/odqbq8CUjqXgpc+oLv aPRg== X-Gm-Message-State: AIkVDXKiAnYiGB3eYcGmJuwD2eZsruDbJ6ILv9hCPFeO+GUwkyGjMCzav5aQUEnPPqn67fdq X-Received: by 10.223.132.39 with SMTP id 36mr11036555wrf.130.1486393032954; Mon, 06 Feb 2017 06:57:12 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id w204sm13300059wmd.17.2017.02.06.06.57.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Feb 2017 06:57:12 -0800 (PST) From: Fabien Parent To: broonie@kernel.org Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, nsekhar@ti.com, ptitiano@baylibre.com, khilman@baylibre.com, Fabien Parent Subject: [PATCH 2/2] spi: davinci: enable DMA when channels are defined in DT Date: Mon, 6 Feb 2017 15:57:08 +0100 Message-Id: <20170206145708.24356-2-fparent@baylibre.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170206145708.24356-1-fparent@baylibre.com> References: <20170206145708.24356-1-fparent@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 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 --- 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 cb80c1d3f86a..b73072ae8adb 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;