From patchwork Mon Jun 2 13:38:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 4282431 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EF98F9F1D6 for ; Mon, 2 Jun 2014 13:50:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3BE8A202F8 for ; Mon, 2 Jun 2014 13:50:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 629DB203DC for ; Mon, 2 Jun 2014 13:50:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754702AbaFBNug (ORCPT ); Mon, 2 Jun 2014 09:50:36 -0400 Received: from winston.telenet-ops.be ([195.130.137.75]:56408 "EHLO winston.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754636AbaFBNug (ORCPT ); Mon, 2 Jun 2014 09:50:36 -0400 Received: from michel.telenet-ops.be (michel.telenet-ops.be [195.130.137.88]) by winston.telenet-ops.be (Postfix) with ESMTP id 4E0EC1BD403 for ; Mon, 2 Jun 2014 15:38:32 +0200 (CEST) Received: from ayla.of.borg ([84.193.72.141]) by michel.telenet-ops.be with bizsmtp id 9ReY1o00C32ts5g06ReYg2; Mon, 02 Jun 2014 15:38:32 +0200 Received: from geert by ayla.of.borg with local (Exim 4.76) (envelope-from ) id 1WrSRb-0007j8-Uo; Mon, 02 Jun 2014 15:38:32 +0200 From: Geert Uytterhoeven To: Mark Brown Cc: Yoshihiro Shimoda , Magnus Damm , linux-spi@vger.kernel.org, linux-sh@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 15/18] spi: rspi: Add DMA support for QSPI on R-Car Gen2 Date: Mon, 2 Jun 2014 15:38:17 +0200 Message-Id: <1401716301-29612-16-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1401716301-29612-1-git-send-email-geert+renesas@glider.be> References: <1401716301-29612-1-git-send-email-geert+renesas@glider.be> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Enable DMA support for QSPI on R-Car Gen2, for Single, Dual, and Quad SPI Transfers. Performance figures for reading from a QSPI FLASH driven at 24.375 MHz on r8a7791/koelsch: - Single: 1.1 Mbps PIO, 23 Mbps DMA - Dual : 12.7 Mbps PIO, 48 Mbps DMA - Quad : 13 Mbps PIO, 70 Mbps DMA Signed-off-by: Geert Uytterhoeven --- drivers/spi/spi-rspi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index b7f8be81423b..bec81470dd9c 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -642,6 +642,9 @@ static int qspi_transfer_out_in(struct rspi_data *rspi, qspi_receive_init(rspi); + if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) + return rspi_dma_transfer(rspi, &xfer->tx_sg, &xfer->rx_sg); + ret = rspi_pio_transfer(rspi, xfer->tx_buf, xfer->rx_buf, xfer->len); if (ret < 0) return ret; @@ -656,6 +659,9 @@ static int qspi_transfer_out(struct rspi_data *rspi, struct spi_transfer *xfer) { int ret; + if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) + return rspi_dma_transfer(rspi, &xfer->tx_sg, NULL); + ret = rspi_pio_transfer(rspi, xfer->tx_buf, NULL, xfer->len); if (ret < 0) return ret; @@ -668,6 +674,9 @@ static int qspi_transfer_out(struct rspi_data *rspi, struct spi_transfer *xfer) static int qspi_transfer_in(struct rspi_data *rspi, struct spi_transfer *xfer) { + if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) + return rspi_dma_transfer(rspi, NULL, &xfer->rx_sg); + return rspi_pio_transfer(rspi, NULL, xfer->rx_buf, xfer->len); }