From patchwork Tue Feb 26 09:24:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 10829755 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5ECFE1399 for ; Tue, 26 Feb 2019 09:25:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A108298DF for ; Tue, 26 Feb 2019 09:25:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E2BD2B050; Tue, 26 Feb 2019 09:25:06 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ED75D298DF for ; Tue, 26 Feb 2019 09:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=BT58zCKkBN5yETB3Z9mehaP1Q09uzFd0HUBsdI0b6kU=; b=psF8eJeCpxWzcv eKGxoaBFrGU+kAqH/tsfbD8HBXYpBW/RZ2EOQmSitufuiPj/Oz1pn3s+F0L3xp2SaSq7ewKD+Pb7O FJ0NV8FGnfQDMZX3kU9W/JDkKeif8Bg02bdWMnsu27eNuJEl+8uY0yoUw19aHqTQcfp5UzAHf3YZ4 u+/7ytxm7TtRciZUwTtjI45+Ur013lfb7fs2AJQySKRJ6ftuaWVAg0LV8Cik0wUuvfV64QSXQ9iaZ 0/OzwArZNapeTQhAzuzMsDdP8kPEbEikyhbS8RsEmKpUUIolthAaIOst0FVrx5aspLUssMiEsfJpc lXzkxteXBkQl/HAUQ5iA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyYyu-0006xE-H7; Tue, 26 Feb 2019 09:24:56 +0000 Received: from mga18.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyYyn-0006vt-3g for linux-arm-kernel@lists.infradead.org; Tue, 26 Feb 2019 09:24:54 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2019 01:24:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,415,1544515200"; d="scan'208";a="322170936" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 26 Feb 2019 01:24:42 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id C6E422B1; Tue, 26 Feb 2019 11:24:41 +0200 (EET) From: Andy Shevchenko To: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, Daniel Mack , Haojian Zhuang , Robert Jarzmik , linux-arm-kernel@lists.infradead.org, Mark Brown , linux-spi@vger.kernel.org, Jarkko Nikula Subject: [PATCH v1 1/3] dt-bindings: Add dma-burst-sz property for spi-pxa2xx Date: Tue, 26 Feb 2019 12:24:39 +0300 Message-Id: <20190226092441.49198-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_012452_570869_92324F0B X-CRM114-Status: GOOD ( 12.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andy Shevchenko Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add DMA burst size property to the SPI PXA2xx bindings. Signed-off-by: Andy Shevchenko --- Documentation/devicetree/bindings/spi/spi-pxa2xx.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt b/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt index e30e0c2a4bce..3b2e70ba7466 100644 --- a/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt +++ b/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt @@ -11,6 +11,7 @@ Required properties: Optional properties: - cs-gpios: list of GPIO chip selects. See the SPI bus bindings, Documentation/devicetree/bindings/spi/spi-bus.txt +- dma-burst-sz: DMA burst size - spi-slave: Empty property indicating the SPI controller is used in slave mode. - ready-gpios: GPIO used to signal a SPI master that the FIFO is filled and we're ready to service a transfer. Only useful in slave mode. From patchwork Tue Feb 26 09:24:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 10829757 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E343917E6 for ; Tue, 26 Feb 2019 09:25:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9F1C298DF for ; Tue, 26 Feb 2019 09:25:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BADD12B050; Tue, 26 Feb 2019 09:25:08 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 57C36298DF for ; Tue, 26 Feb 2019 09:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ttp63iQ+Lj80OGqJ+hE23KBjFrtwaPUVQtyObhNvUMQ=; b=TwACgWYthok0v5 AsF+uOSfmdj8k/7A5Vj/zcTD3/iNVY5silwJufqAQA7R8qPIv1XD2xb8J0Fey3rjGMJaJg/97PQgF C/CXPRNb8zy16Ssucr3nDMRyjGkrMjs8R60Kqc9/6TanLFwSAMeNFlv/hmPPl1skcjXT1B6UwuaLm R8h95YY4Tsa7ouxgjkJihA/DVs89c/vLD/ehiap/deTCD/D0JSqS5T6TrrIENGXXB/WnRjr72MLu5 a76pJ+YzoAuUkWAUVcmRyV4gQYyKESJXnir75g6nUkMm2dKwtnda5HeVDJIoSM3wGvunJnNGueJbW jiXKmG4C2ZAP5pnrdpdg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyYz4-0007Bd-KP; Tue, 26 Feb 2019 09:25:06 +0000 Received: from mga05.intel.com ([192.55.52.43]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyYym-0006vs-NG for linux-arm-kernel@lists.infradead.org; Tue, 26 Feb 2019 09:24:54 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2019 01:24:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,415,1544515200"; d="scan'208";a="146607221" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 26 Feb 2019 01:24:42 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id D406A161; Tue, 26 Feb 2019 11:24:41 +0200 (EET) From: Andy Shevchenko To: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, Daniel Mack , Haojian Zhuang , Robert Jarzmik , linux-arm-kernel@lists.infradead.org, Mark Brown , linux-spi@vger.kernel.org, Jarkko Nikula Subject: [PATCH v1 2/3] spi: pxa2xx: Introduce dma-burst-sz property support Date: Tue, 26 Feb 2019 12:24:40 +0300 Message-Id: <20190226092441.49198-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226092441.49198-1-andriy.shevchenko@linux.intel.com> References: <20190226092441.49198-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_012452_571235_CF85FE5D X-CRM114-Status: GOOD ( 16.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andy Shevchenko Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some masters may have different DMA burst size than hard coded default. In such case respect the value given by dma-burst-size property. Signed-off-by: Andy Shevchenko Reviewed-by: Robert Jarzmik --- drivers/spi/spi-pxa2xx-dma.c | 4 +++- drivers/spi/spi-pxa2xx-pci.c | 8 +++++++- drivers/spi/spi-pxa2xx.c | 5 ++++- include/linux/spi/pxa2xx_spi.h | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index 2fa7f4b43492..3343fff81c7b 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c @@ -239,13 +239,15 @@ int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip, u32 *threshold) { struct pxa2xx_spi_chip *chip_info = spi->controller_data; + struct driver_data *drv_data = spi_controller_get_devdata(spi->controller); + u32 dma_burst_size = drv_data->master_info->dma_burst_size; /* * If the DMA burst size is given in chip_info we use that, * otherwise we use the default. Also we use the default FIFO * thresholds for now. */ - *burst_code = chip_info ? chip_info->dma_burst_size : 1; + *burst_code = chip_info ? chip_info->dma_burst_size : dma_burst_size; *threshold = SSCR1_RxTresh(RX_THRESH_DFLT) | SSCR1_TxTresh(TX_THRESH_DFLT); diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index d3de925892cb..1db1b64cfba8 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -5,9 +5,9 @@ */ #include #include -#include #include #include +#include #include #include @@ -200,6 +200,7 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, struct pxa2xx_spi_master spi_pdata; struct ssp_device *ssp; struct pxa_spi_info *c; + u32 dma_burst_sz; char buf[40]; ret = pcim_enable_device(dev); @@ -217,12 +218,17 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, return ret; } + ret = device_property_read_u32(&dev->dev, "dma-burst-sz", &dma_burst_sz); + if (ret) + dma_burst_sz = 1; + memset(&spi_pdata, 0, sizeof(spi_pdata)); spi_pdata.num_chipselect = (c->num_chipselect > 0) ? c->num_chipselect : dev->devfn; spi_pdata.dma_filter = c->dma_filter; spi_pdata.tx_param = c->tx_param; spi_pdata.rx_param = c->rx_param; spi_pdata.enable_dma = c->rx_param && c->tx_param; + spi_pdata.dma_burst_size = dma_burst_sz; ssp = &spi_pdata.ssp; ssp->phys_base = pci_resource_start(dev, 0); diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 8dd67d722aae..393e020c757a 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1512,6 +1513,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) const struct acpi_device_id *adev_id = NULL; const struct pci_device_id *pcidev_id = NULL; const struct of_device_id *of_id = NULL; + struct device *dev = &pdev->dev; enum pxa_ssp_type type; adev = ACPI_COMPANION(&pdev->dev); @@ -1566,9 +1568,10 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) ssp->pdev = pdev; ssp->port_id = pxa2xx_spi_get_port_id(adev); - pdata->is_slave = of_property_read_bool(pdev->dev.of_node, "spi-slave"); + pdata->is_slave = device_property_read_bool(dev, "spi-slave"); pdata->num_chipselect = 1; pdata->enable_dma = true; + pdata->dma_burst_size = 1; return pdata; } diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h index b0674e330ef6..154da8cd4781 100644 --- a/include/linux/spi/pxa2xx_spi.h +++ b/include/linux/spi/pxa2xx_spi.h @@ -25,6 +25,7 @@ struct dma_chan; struct pxa2xx_spi_master { u16 num_chipselect; u8 enable_dma; + u8 dma_burst_size; bool is_slave; /* DMA engine specific config */ From patchwork Tue Feb 26 09:24:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 10829759 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65D391399 for ; Tue, 26 Feb 2019 09:25:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50DFF29A1C for ; Tue, 26 Feb 2019 09:25:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44A172B154; Tue, 26 Feb 2019 09:25:39 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E9BCD29A1C for ; Tue, 26 Feb 2019 09:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DYjRmNGxwyUqHom88JXH6yMBzu5eu0mmxVoJkRLq8Ss=; b=pzqtbopT3nIPMc aAIVdYFsrbja0r7ngOVolRWNJKwhdfH9dx1pIUen+ddJl6TFUqkHeeuvRE20j2CEeuoqAO7fz94j/ 1suAx44D139Nzku0T8BrUEf2Nz4UMSY/YzW2Lbl6Kfbe1JGJW0+qTsstUc38XYn2i9kU43yXjjB9P Zd6odsi+YHwfdtZMvVp+/U5dm4GWDgEkNUwaLlWjl1uV+wyl1Pk2bDIBeHg3w2WvtvUyuMRRWqKJV PtF7z+cxXAzS9XdrvgmMCUlPAhk1yhVafGkngPdEqh3eNZLwkrDa36aNU9nL22YW23ZdD24hJNp7z z/gdiWIw9Lv/qRooLElA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyYzV-0000Oq-TN; Tue, 26 Feb 2019 09:25:33 +0000 Received: from mga18.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gyYys-0006vt-CW for linux-arm-kernel@lists.infradead.org; Tue, 26 Feb 2019 09:24:55 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2019 01:24:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,415,1544515200"; d="scan'208";a="141701946" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 26 Feb 2019 01:24:42 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id DB4F154A; Tue, 26 Feb 2019 11:24:41 +0200 (EET) From: Andy Shevchenko To: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, Daniel Mack , Haojian Zhuang , Robert Jarzmik , linux-arm-kernel@lists.infradead.org, Mark Brown , linux-spi@vger.kernel.org, Jarkko Nikula Subject: [PATCH v1 3/3] spi: pxa2xx: Debug print DMA burst and threshold Date: Tue, 26 Feb 2019 12:24:41 +0300 Message-Id: <20190226092441.49198-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226092441.49198-1-andriy.shevchenko@linux.intel.com> References: <20190226092441.49198-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_012454_470311_17A01811 X-CRM114-Status: GOOD ( 13.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andy Shevchenko Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP It's useful during debug to see what DMA burst and threshold sizes are. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 393e020c757a..534460a29432 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1339,6 +1339,9 @@ static int setup(struct spi_device *spi) dev_warn(&spi->dev, "in setup: DMA burst size reduced to match bits_per_word\n"); } + dev_dbg(&spi->dev, + "in setup: DMA burst and threshold set to %u, %u\n", + chip->dma_burst_size, chip->dma_threshold); } switch (drv_data->ssp_type) {