From patchwork Sun Sep 14 14:45:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Epler X-Patchwork-Id: 4901531 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 94DFB9F2EC for ; Sun, 14 Sep 2014 15:03:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A68420260 for ; Sun, 14 Sep 2014 15:06:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FA6D2020E for ; Sun, 14 Sep 2014 15:06:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752618AbaINPGm (ORCPT ); Sun, 14 Sep 2014 11:06:42 -0400 Received: from rrcs-76-79-27-186.west.biz.rr.com ([76.79.27.186]:26899 "EHLO rrcs-76-79-27-186.west.biz.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752595AbaINPGl (ORCPT ); Sun, 14 Sep 2014 11:06:41 -0400 Received: from jepler by zaphod.unpythonic.net with local (Exim 4.80) (envelope-from ) id 1XTB36-0005RW-HT; Sun, 14 Sep 2014 09:45:08 -0500 From: Jeff Epler To: linux@vger.kernel.org, linux-spi@vger.kernel.org Subject: [RFC 4/4] spidev-s3c64xx: allocate dma channel at startup Date: Sun, 14 Sep 2014 09:45:08 -0500 Message-Id: <1410705908-20847-5-git-send-email-jepler@unpythonic.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1410705908-20847-1-git-send-email-jepler@unpythonic.net> References: <1410705908-20847-1-git-send-email-jepler@unpythonic.net> 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=ham 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 it appears that acquire_dma introduces intolerable delays; the system is fine with the dma channnels allocated all the time. --- drivers/spi/spi-s3c64xx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 92de1b5..e6a46c9 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -797,10 +797,6 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi) { struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(spi); - /* Acquire DMA channels */ - while (!acquire_dma(sdd)) - msleep(10); - pm_runtime_get_sync(&sdd->pdev->dev); return 0; @@ -810,10 +806,6 @@ static int s3c64xx_spi_unprepare_transfer(struct spi_master *spi) { struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(spi); - /* Free DMA channels */ - sdd->ops->release(sdd->rx_dma.ch, &s3c64xx_spi_dma_client); - sdd->ops->release(sdd->tx_dma.ch, &s3c64xx_spi_dma_client); - pm_runtime_put(&sdd->pdev->dev); return 0; @@ -1344,6 +1336,9 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) goto err7; } + // cannot fail(?) + acquire_dma(sdd); + writel(S3C64XX_SPI_INT_RX_OVERRUN_EN | S3C64XX_SPI_INT_RX_UNDERRUN_EN | S3C64XX_SPI_INT_TX_OVERRUN_EN | S3C64XX_SPI_INT_TX_UNDERRUN_EN, sdd->regs + S3C64XX_SPI_INT_EN); @@ -1396,6 +1391,10 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) spi_unregister_master(master); + /* Free DMA channels */ + sdd->ops->release(sdd->rx_dma.ch, &s3c64xx_spi_dma_client); + sdd->ops->release(sdd->tx_dma.ch, &s3c64xx_spi_dma_client); + writel(0, sdd->regs + S3C64XX_SPI_INT_EN); free_irq(platform_get_irq(pdev, 0), sdd);