From patchwork Wed Oct 10 09:00:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Renner Berthing X-Patchwork-Id: 10634225 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 0DAC669B4 for ; Wed, 10 Oct 2018 09:02:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B4C22974B for ; Wed, 10 Oct 2018 09:02:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F30A5298D7; Wed, 10 Oct 2018 09:02:23 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 A17B72974B for ; Wed, 10 Oct 2018 09:02:23 +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=sZxLrZqgbtegT2CtHijG+swPli4Uyd3PrFN1xzYFxTk=; b=YQ2vPFpLEUO8l2 cF5RjWwDNPEztsBFR+QDgBSH8rrnScOZtMBdLQi8baHL6abDJliy10GHxYeBAhFk9eG7Ngdr46n3v 477szs1IiT+8sfZklibkjtWvz3vGzsJV0lbtqYwaijrwXNssnZlXzVdPfT94u2bY2xKy27p58FJEJ UZ2fFMnqHmZ2JMLUVrbRuiEZzBjMUOd+SsRFdV0hR8G3xt8pnti8nqEBpvS5EH3OVCtbfHJg/7EUy mYEKaHqm3Xgm1PqK+pea/cx0t+aFcnsUhDOOCT+oCNDboU9+BDhohnHcr3ziHG6L7TgCg9+0FWcdR 50/2z4Y2Vox+hWYHx2ig==; 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 1gAANd-00059E-1J; Wed, 10 Oct 2018 09:02:09 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAANR-00053p-BN; Wed, 10 Oct 2018 09:01:59 +0000 Received: by mail-lj1-x243.google.com with SMTP id x3-v6so4142084lji.13; Wed, 10 Oct 2018 02:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=joyn6OLBg1f4D+Fifxa/SS4Ke79l5wLNhvUf6HfLSis=; b=UwzqO7dLXaqGsobplb0rRenHcymcWD4t0o/wLYke1IE5ecHCzgaE4iY+GsfUTF+n7L BudA0/q5lMD8Y9t1A1Iy2/yzawrWgZmw6CU8gNVGVmFifPZ39+2Rg1aQFkKu7yfccP2l EMhCNFegmYEuTK3e/Eox9SiCKC+Kjd2b8nODMY284WUNvN7gGmA5PiHnpYcsPNpZta0M ynwl+LMhMYW7uIjei+JdBM7p+CuZ37+LJRIZv0JtsO+oKYgF2htYdtXGHBBn2Cr5UHw9 2pp7uKSNegWGr5y0E1w+qgd1I2UTH+D818xRFQUclIWuuHhlR4rJ9rlsfg2QnqICPM4m yazA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=joyn6OLBg1f4D+Fifxa/SS4Ke79l5wLNhvUf6HfLSis=; b=rDrEpBYCPUDvVvqJNeod3fZmvSz6/pIzVyIAj6Bdun6t38AjfYACWzRThH2TN/Fh7p N8RYKn9gIDxNuW9lWh8R2MbQ0mAOjWzfzVEsyMaKIlmG3jRJsMIlhHpAEglBq+p8Y4tW HCcGVawdBzQVEB+QtdLSatiprBoyUZ48F1JQInD58lf5nh12vSpKeXEpUtmnlDEWI8TI oV/gkYb7syIiGxr7JDX749RnhD/AJaqmKN3kebK8g1uiOdo8w3kujs5fhcZoOk1Bsydv NI1/pw8+GVqClv8ZyO2rXyYD2Uue2uvX3d5atgJjyy1znZvmQMSpjT4LfVUHKUpylntH kzkw== X-Gm-Message-State: ABuFfojpybw37YFaNkvsr/PWYMORBQjvDnJQslPyyAbxCQei7Mg56INi U8gnq0RHJ4WjAZ2WmDhqJd0F+k4yc6k= X-Google-Smtp-Source: ACcGV60CUCC4NeYdYDziVaGp4qNnsIFv551K06yJPnVj2rcCu4FGrg18xdg4WZDUVlp6O8cwMey8tQ== X-Received: by 2002:a2e:4751:: with SMTP id u78-v6mr9503679lja.72.1539162106471; Wed, 10 Oct 2018 02:01:46 -0700 (PDT) Received: from localhost.localdomain ([5.57.50.195]) by smtp.gmail.com with ESMTPSA id q2-v6sm2150078lfc.67.2018.10.10.02.01.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 02:01:45 -0700 (PDT) From: Emil Renner Berthing To: linux-rockchip@lists.infradead.org Subject: [PATCH 1/7] spi: rockchip: initialize dma_slave_config properly Date: Wed, 10 Oct 2018 11:00:32 +0200 Message-Id: <20181010090038.20834-2-kernel@esmil.dk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181010090038.20834-1-kernel@esmil.dk> References: <20181010090038.20834-1-kernel@esmil.dk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_020157_454178_933EACE8 X-CRM114-Status: GOOD ( 10.58 ) 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: Mark Rutland , devicetree@vger.kernel.org, Randy Li , Emil Renner Berthing , Huibin Hong , Brian Norris , Douglas Anderson , Rob Herring , linux-kernel@vger.kernel.org, Chris Zhong , Nickey Yang , Mark Brown , Klaus Goger , Enric Balletbo i Serra , linux-spi@vger.kernel.org, Shunqian Zheng , linux-arm-kernel@lists.infradead.org, Heiko Stuebner 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 From: Huibin Hong The rxconf and txconf structs are allocated on the stack, so make sure we zero them before filling out the relevant fields. Signed-off-by: Huibin Hong Signed-off-by: Emil Renner Berthing --- drivers/spi/spi-rockchip.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index fdcf3076681b..185bbdce62b1 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -445,6 +445,9 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) struct dma_slave_config rxconf, txconf; struct dma_async_tx_descriptor *rxdesc, *txdesc; + memset(&rxconf, 0, sizeof(rxconf)); + memset(&txconf, 0, sizeof(txconf)); + spin_lock_irqsave(&rs->lock, flags); rs->state &= ~RXBUSY; rs->state &= ~TXBUSY; From patchwork Wed Oct 10 09:00:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Renner Berthing X-Patchwork-Id: 10634233 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 2750D13AD for ; Wed, 10 Oct 2018 09:04:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19E41293EF for ; Wed, 10 Oct 2018 09:04:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 093B9295B3; Wed, 10 Oct 2018 09:04:40 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 6FBE1293EF for ; Wed, 10 Oct 2018 09:04:39 +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=DXMIxPfVi8Ea1asS0LmLy38NFEBpPEm7ziW0ZoGQUIg=; b=BD/FFr1l1vnYpp CYEUwezhB4+4HNRENCxOb1Q2aYRTao/AXCbaXG4a3krNlG1UTh5xdhKXxsRtbFn5b+mqzBJ6J4WkK oKSMtc1rFXLGxdaEjKxD+eKFyBII5iz21x9PGl7JxoWmxN/5fJ3a8j2AhDQWsRIMQhMVm0MnOHB+K a/lxOvux35oVWNpXrPw/BCqILSf94785wDTDl8LSsHj52ulCzZ9hGZTG2KAJslZNzUjauV4NQdRBA /QWND1BpAnxp7B3XMX+HUyHClEDRbm0yAldtDOP/pz6UPXxmZSCnUWLRNTxthIu2lwMWBlXam3ZPm c+HSzY5kWHf0s9aGGbvQ==; 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 1gAAPr-0006IL-Cz; Wed, 10 Oct 2018 09:04:27 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAANU-00053q-Ri; Wed, 10 Oct 2018 09:02:07 +0000 Received: by mail-lj1-x241.google.com with SMTP id o14-v6so4176863ljj.2; Wed, 10 Oct 2018 02:01:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WLfksrGx9Fi3iwQ2Hcus/p3nhLsfw8qp1vLf53uAlEc=; b=RSejjSeZ6UhaZsuSXgI45iX6TxJslop2N/nCVC7r68sgO1ItowxP8go10qsOGLPH2k eGjBrF23DYoa/pAorVvh8BJfb3Tp5YbSYmI1IeRCUVP/s1PA8DacTRK75UiGUlVE67xr SukxDBWAQ0AhhSRfmBQtyn9aE00Dm6771pCaB15GT5tAg8b+Fk2R+aU0Nyi72CEufsyK CF8QVG8oCTTDQ+j/EkC92rmDN4m4ZfwQ717ZKhzTPUFZnat4x7bzvMokQ/KQhkDVFHQ7 lFu7X6bAI45pylKqJpBRYBEjjU6C8pbVhVc/xTGPAdEU0FEZSuutx04Mv2o3yBET/Pom QBlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=WLfksrGx9Fi3iwQ2Hcus/p3nhLsfw8qp1vLf53uAlEc=; b=dOzO4FQdrukDWwzLYIs1tPsn2J1UM2UNxKxVJdQ7k/wRVb0egcadVz5bqb+QL3EHa7 vVBUf1cMdVK64lz/OoCvMTVt9f0PLz0zIxmZeaus73Bs3wAZhaNbGmN1HBElmYg4CNaS wFLOmRJ4oCz1ipIP5M5ZONCTXQgziWqpSLdMEWZDiwZC8a983/lg6s9jE/+bJds5JvTK is9Q9yZy5UcXmuK45G6+iiEjCckf86EAWuZ0abC+PqK3Rs/b3Ftt9ijbierZ8u3pw7KS gceVzDGp7QM+86nbThiOjbQM1LTpWvtZqmQJzU3di/pPje27veiOxHVennk2H6c7LtfN /0gw== X-Gm-Message-State: ABuFfohO1T4QTw2VddK73nSzMgW698zX8MPVG4q/6E+VavpyopeHzJ7B FEQ7d5iyoQuhVH0IZmd0K59sOTakSyE= X-Google-Smtp-Source: ACcGV62ST321hoWnmn1sD9Ow7VAjsVxgvBxPdyTAUZv0RRCfGXsbbXLP0VSGim+kpzKLjBePZ/2W0w== X-Received: by 2002:a2e:87da:: with SMTP id v26-v6mr21776381ljj.13.1539162108528; Wed, 10 Oct 2018 02:01:48 -0700 (PDT) Received: from localhost.localdomain ([5.57.50.195]) by smtp.gmail.com with ESMTPSA id q2-v6sm2150078lfc.67.2018.10.10.02.01.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 02:01:47 -0700 (PDT) From: Emil Renner Berthing To: linux-rockchip@lists.infradead.org Subject: [PATCH 2/7] spi: rockchip: adjust dma watermark and burstlen Date: Wed, 10 Oct 2018 11:00:33 +0200 Message-Id: <20181010090038.20834-3-kernel@esmil.dk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181010090038.20834-1-kernel@esmil.dk> References: <20181010090038.20834-1-kernel@esmil.dk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_020200_926450_7D53D364 X-CRM114-Status: GOOD ( 12.89 ) 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: Mark Rutland , devicetree@vger.kernel.org, Randy Li , Emil Renner Berthing , Huibin Hong , Brian Norris , Douglas Anderson , Rob Herring , linux-kernel@vger.kernel.org, Chris Zhong , Nickey Yang , Mark Brown , Klaus Goger , Enric Balletbo i Serra , linux-spi@vger.kernel.org, Shunqian Zheng , linux-arm-kernel@lists.infradead.org, Heiko Stuebner 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 From: Huibin Hong Signal tx dma when spi fifo is less than half full, and limit tx bursts to half the fifo length. Clamp rx burst length to 1 to avoid alignment issues. Signed-off-by: Huibin Hong Signed-off-by: Emil Renner Berthing --- drivers/spi/spi-rockchip.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 185bbdce62b1..ede3002215cd 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -458,10 +458,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) rxconf.direction = rs->dma_rx.direction; rxconf.src_addr = rs->dma_rx.addr; rxconf.src_addr_width = rs->n_bytes; - if (rs->dma_caps.max_burst > 4) - rxconf.src_maxburst = 4; - else - rxconf.src_maxburst = 1; + rxconf.src_maxburst = 1; dmaengine_slave_config(rs->dma_rx.ch, &rxconf); rxdesc = dmaengine_prep_slave_sg( @@ -480,10 +477,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) txconf.direction = rs->dma_tx.direction; txconf.dst_addr = rs->dma_tx.addr; txconf.dst_addr_width = rs->n_bytes; - if (rs->dma_caps.max_burst > 4) - txconf.dst_maxburst = 4; - else - txconf.dst_maxburst = 1; + txconf.dst_maxburst = rs->fifo_len / 2; dmaengine_slave_config(rs->dma_tx.ch, &txconf); txdesc = dmaengine_prep_slave_sg( @@ -581,7 +575,7 @@ static void rockchip_spi_config(struct rockchip_spi *rs) writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_TXFTLR); writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_RXFTLR); - writel_relaxed(0, rs->regs + ROCKCHIP_SPI_DMATDLR); + writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_DMATDLR); writel_relaxed(0, rs->regs + ROCKCHIP_SPI_DMARDLR); writel_relaxed(dmacr, rs->regs + ROCKCHIP_SPI_DMACR); From patchwork Wed Oct 10 09:00:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Renner Berthing X-Patchwork-Id: 10634231 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 166EF17E1 for ; Wed, 10 Oct 2018 09:03:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B197292AD for ; Wed, 10 Oct 2018 09:03:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C90D293AE; Wed, 10 Oct 2018 09:03:51 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 22710292AD for ; Wed, 10 Oct 2018 09:03:50 +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=xwaZu7h45ezWGU0EEjFPR9KO6DegQLqP99c5RLPbs08=; b=AczGd+jMhB1Gvm r/fhFeeFFGt1CqIAnd43daLpF+XKXsTkj+fo9p+vw+cZ6QvkqV/LpX2OD1wGkAzhEbf2DUPbkgC2j QmqOHGCT70Q8sRYYV5LApayk6VGbdJHPGR2tChUwlNJAcjtelmfrUVJjClhIQfY6VcpUVrESsTvju dGrjShSFvfsgd8GC+nMdd8PC17bPPCQuW6xi4CTRz1Dk/vOguYxjR9fjMiDDH3qybmGxpd+fK5NDi EdPvjLkKHIgTgGzs2XjbHtIT8QWM5gUccz6W5M+8on4Sem89y7x1Vm2utz3L6IjXnOQeR5uT5Fa0B 2ayfp75MKXiTOXbsvQmA==; 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 1gAAP2-0005vq-Dq; Wed, 10 Oct 2018 09:03:36 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAANR-00053v-BE; Wed, 10 Oct 2018 09:02:02 +0000 Received: by mail-lj1-x243.google.com with SMTP id p89-v6so4177657ljb.3; Wed, 10 Oct 2018 02:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J2OCDbqMb6nYqZMgYt5ZgfyBJjth2xz5R26iqEUWcAQ=; b=hAbxJ1ufKoTUfC9+bybFXqMl6xW9gPx+FObVDUNTyVkBcCW9ztLNHOjb5WAK1mDd8l zm3E4wnDrAjX8ToF6eRABtTHdUWplLFNXscwkbjfH4QH/GizXljSYTlfMwMtdhluEyyJ FOsChJObB6cZu8imfx9BkC4NZ/SSJpAJAGtabZqlEI9TxiMdf8LHGzvBt4kMO89tdHL7 NkWfhJFpfbamQxjph9JI3J5hbtFclGIUKdppPhsnIs0WL+jF/7GT+h8sp8is0fXnYOtX OL3Z+gQiWYFbmLxmVuLuUJEG4yL2CPX8KGmk5vPEkozPLz7sU7LmYvlzfTI35VfO4lhO OiMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=J2OCDbqMb6nYqZMgYt5ZgfyBJjth2xz5R26iqEUWcAQ=; b=kSiFfcOFQ1LRCyXzr9CW9fJMDO59uFyg8TMcEJUhvOrXKYuD45gZbMVJ8PxWgrQ+MQ tH8reMdEPgucQ8BrWeRZ6gHWuBRGik9aWdwtbIxcr8lfCOQxM8CUNsQXUQbGe4lXwUlr ElUiTA1Q3H1nQYNEoAEc9Iuz+WGuB9IHBpSgZYDGjWtZ50IrSeOTjZPfs0IagBXIuy5B qcSOW/21E95pffF6zDX5s48TjTl7dZKdPcDTlMSOOSXNwnJE3iAQRRDuV0RMA90GPdrs GvmnW2IgqBFTcmFt60VJjbrzthBEgkKDZGHgUVHwIZSpFeiZpYDDTYRD8VOWQOfVBIUB hQ8w== X-Gm-Message-State: ABuFfoinNL8okbItPsYMHxrDpEIWPHl2jl0Pf8AifuVIdJm6kvqjd1z3 DSPBlo5Fm/ch7oEW7KC3UDuv2WwNfs0= X-Google-Smtp-Source: ACcGV63uwLPLZdfv3hnbQRd0TrjuL4yIGVC5cnIviIAM0Gehi8XYdbWm1+MDo/RYkKayofZmOx7GbA== X-Received: by 2002:a2e:6e08:: with SMTP id j8-v6mr16663276ljc.61.1539162110537; Wed, 10 Oct 2018 02:01:50 -0700 (PDT) Received: from localhost.localdomain ([5.57.50.195]) by smtp.gmail.com with ESMTPSA id q2-v6sm2150078lfc.67.2018.10.10.02.01.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 02:01:49 -0700 (PDT) From: Emil Renner Berthing To: linux-rockchip@lists.infradead.org Subject: [PATCH 3/7] arm64: dts: rockchip: add rk3399 SPI DMAs Date: Wed, 10 Oct 2018 11:00:34 +0200 Message-Id: <20181010090038.20834-4-kernel@esmil.dk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181010090038.20834-1-kernel@esmil.dk> References: <20181010090038.20834-1-kernel@esmil.dk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_020157_459990_2F7352F5 X-CRM114-Status: GOOD ( 15.30 ) 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: Mark Rutland , devicetree@vger.kernel.org, Randy Li , Emil Renner Berthing , Brian Norris , Douglas Anderson , Rob Herring , linux-kernel@vger.kernel.org, Chris Zhong , Nickey Yang , Mark Brown , Klaus Goger , Enric Balletbo i Serra , linux-spi@vger.kernel.org, Shunqian Zheng , linux-arm-kernel@lists.infradead.org, Heiko Stuebner 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 spi dma channels as specified by the rk3399 TRM. Signed-off-by: Emil Renner Berthing --- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index c88e603396f6..c11b5ae6f1ad 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi @@ -653,6 +653,8 @@ clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>; clock-names = "spiclk", "apb_pclk"; interrupts = ; + dmas = <&dmac_peri 10>, <&dmac_peri 11>; + dma-names = "tx", "rx"; pinctrl-names = "default"; pinctrl-0 = <&spi0_clk &spi0_tx &spi0_rx &spi0_cs0>; #address-cells = <1>; @@ -666,6 +668,8 @@ clocks = <&cru SCLK_SPI1>, <&cru PCLK_SPI1>; clock-names = "spiclk", "apb_pclk"; interrupts = ; + dmas = <&dmac_peri 12>, <&dmac_peri 13>; + dma-names = "tx", "rx"; pinctrl-names = "default"; pinctrl-0 = <&spi1_clk &spi1_tx &spi1_rx &spi1_cs0>; #address-cells = <1>; @@ -679,6 +683,8 @@ clocks = <&cru SCLK_SPI2>, <&cru PCLK_SPI2>; clock-names = "spiclk", "apb_pclk"; interrupts = ; + dmas = <&dmac_peri 14>, <&dmac_peri 15>; + dma-names = "tx", "rx"; pinctrl-names = "default"; pinctrl-0 = <&spi2_clk &spi2_tx &spi2_rx &spi2_cs0>; #address-cells = <1>; @@ -692,6 +698,8 @@ clocks = <&cru SCLK_SPI4>, <&cru PCLK_SPI4>; clock-names = "spiclk", "apb_pclk"; interrupts = ; + dmas = <&dmac_peri 18>, <&dmac_peri 19>; + dma-names = "tx", "rx"; pinctrl-names = "default"; pinctrl-0 = <&spi4_clk &spi4_tx &spi4_rx &spi4_cs0>; #address-cells = <1>; @@ -705,6 +713,8 @@ clocks = <&cru SCLK_SPI5>, <&cru PCLK_SPI5>; clock-names = "spiclk", "apb_pclk"; interrupts = ; + dmas = <&dmac_bus 8>, <&dmac_bus 9>; + dma-names = "tx", "rx"; pinctrl-names = "default"; pinctrl-0 = <&spi5_clk &spi5_tx &spi5_rx &spi5_cs0>; power-domains = <&power RK3399_PD_SDIOAUDIO>; From patchwork Wed Oct 10 09:00:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Renner Berthing X-Patchwork-Id: 10634237 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 E32AF679F for ; Wed, 10 Oct 2018 09:05:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBFF1295B3 for ; Wed, 10 Oct 2018 09:05:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D005929696; Wed, 10 Oct 2018 09:05: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 2BFA5295B3 for ; Wed, 10 Oct 2018 09:05:39 +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=DudLHEEglcdrXRnEKe14iPkFZCYTPfOcf5L8ZQyd1uY=; b=mJzMyPQwtCWKXv 45+a2MCgPAQJjlxa93uwijbXN3Qo6B2+lNV+mKvSr7mPdsFalZzq+RUbk4JHnC4m/AKiJsR07bLcR H4j56NWLDM5eGXp+k3ZbqRedz4AE3JXZzxRaicSvAnHyP6q2jhOcsudLcmb0+9DxN0FDO2D2dpre4 hQ2PiP4MxoLPxri1Kz06+ulMlq5Rg/5z5xAqqxNSVtIxu2vJDZTVBEShvsz9tb/iQk0zxgOSFqnRY NUDT85+b8HKVBQBDFvv2D3eCvcyqTkTE+S0Yp0PKToWChxuGZSwBbIq6VHrITaXkEkS7p9B5dTrSR 7TxU3FUoMTOtfOKYBGiA==; 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 1gAAQn-0007R2-FD; Wed, 10 Oct 2018 09:05:25 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAANY-000540-T4; Wed, 10 Oct 2018 09:02:15 +0000 Received: by mail-lj1-x242.google.com with SMTP id p1-v6so4158878ljg.6; Wed, 10 Oct 2018 02:01:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KG0sdeNKejQuoulTZccIXDqy9239NiodF80G4qiM8YQ=; b=dwX9tbl84V4YOiGml1DAurWDeR8exFtugbPJNbxcT3UPtyFENSkRyU7ZEQo4JxO3zW LL3mP7Pwto6nYU5Rnv1WinEOVonO69hBozgBT71UJrGcC8lEGSjSIo+IjfAko3INSbWk t79mekUZ75iYa+X6RUO4Iyh0xOxpAu+yAjTWl4ztfjMBkfvbq01jf0ETYt0KWnXJ1Gir UZqORd56eG+GrRYSVcuXJ3uzesS8A4+ya28Fywns7SwZ39Tci6LS2mGP7OoXfm2q2ELm IMalUTbuGHegep8O24FSD48kBick+APcQfwuut7nbTTtFnqRPywJL1LbQ5030Wg3kFp3 i0Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=KG0sdeNKejQuoulTZccIXDqy9239NiodF80G4qiM8YQ=; b=ZfMMPrBjZe3hKyZuacKv4jjtiUH/yD3htyPpzAvzRO2zj83R1NpCejiwhZSkTceuOH ZjW6tooH9frWbafUEJ9a5SOxucX1CMRRuGNzeS5aSlC7U052jz4gm6NbBmZlT3revui6 J0K1fzpkLXwz7ACcUewAIJkDuUxGpu9/S9XncoDur0vurmB7ekGJJh5x+ISnBc9cifsR hwgEpqPYdbEKb64PuEo6MGEmtQpikb8f7YW+lxMC1NSHvHJMgS6ouwEb7SdfLdWrkYWW 1F0EvuBhRNAIG6jwbuFKFcy7+1y+HmDEBcoo0nKnVQ6ljQ7tLqdW79FMoW2f/UfSGLxn 631w== X-Gm-Message-State: ABuFfogJH3AaY0e68mICFdjISIUWBVzAuU+3hZJBPFpCUwLbCFfJVs0g XsAUi2x49NpFucd9s6LxbhbJG97LBkg= X-Google-Smtp-Source: ACcGV63TMn627laop0LM3zRqknrAUhl3yFoTD9zz7aGaR1gtxHWXJT/rawTYEFsTs7pc0qLsOeK/Bw== X-Received: by 2002:a2e:8684:: with SMTP id l4-v6mr3079435lji.52.1539162112525; Wed, 10 Oct 2018 02:01:52 -0700 (PDT) Received: from localhost.localdomain ([5.57.50.195]) by smtp.gmail.com with ESMTPSA id q2-v6sm2150078lfc.67.2018.10.10.02.01.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 02:01:51 -0700 (PDT) From: Emil Renner Berthing To: linux-rockchip@lists.infradead.org Subject: [PATCH 4/7] spi: rockchip: remove unneeded dma_caps Date: Wed, 10 Oct 2018 11:00:35 +0200 Message-Id: <20181010090038.20834-5-kernel@esmil.dk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181010090038.20834-1-kernel@esmil.dk> References: <20181010090038.20834-1-kernel@esmil.dk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_020204_987503_5BC59D3F X-CRM114-Status: GOOD ( 12.30 ) 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: Mark Rutland , devicetree@vger.kernel.org, Randy Li , Emil Renner Berthing , Brian Norris , Douglas Anderson , Rob Herring , linux-kernel@vger.kernel.org, Chris Zhong , Nickey Yang , Mark Brown , Klaus Goger , Enric Balletbo i Serra , linux-spi@vger.kernel.org, Shunqian Zheng , linux-arm-kernel@lists.infradead.org, Heiko Stuebner 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 We no longer need the dma_caps since the dma driver already clamps the burst length to the hardware limit, so don't request and store dma_caps in device data. Signed-off-by: Emil Renner Berthing --- drivers/spi/spi-rockchip.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index ede3002215cd..85358f96f78f 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -207,7 +207,6 @@ struct rockchip_spi { struct sg_table rx_sg; struct rockchip_spi_dma_data dma_rx; struct rockchip_spi_dma_data dma_tx; - struct dma_slave_caps dma_caps; }; static inline void spi_enable_chip(struct rockchip_spi *rs, int enable) @@ -777,7 +776,6 @@ static int rockchip_spi_probe(struct platform_device *pdev) } if (rs->dma_tx.ch && rs->dma_rx.ch) { - dma_get_slave_caps(rs->dma_rx.ch, &(rs->dma_caps)); rs->dma_tx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_TXDR); rs->dma_rx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_RXDR); rs->dma_tx.direction = DMA_MEM_TO_DEV; From patchwork Wed Oct 10 09:00:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Renner Berthing X-Patchwork-Id: 10634239 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 2E27517E1 for ; Wed, 10 Oct 2018 09:06:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ABFC292AD for ; Wed, 10 Oct 2018 09:06:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EABB295B3; Wed, 10 Oct 2018 09:06:26 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 F0549292AD for ; Wed, 10 Oct 2018 09:06:25 +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=weXB7dklVsafOpQ2QtnoKio86HcWG9+Cy5mI3DNx4dk=; b=ZClAJdqqtazy9z 0F4NzsNKFO2NuIPcboDktPk72DV6mulu0A18qLPD0FR7HM9TO+pCnaltvonu6IbfhP8LsmxjrsWQQ kuBEfF8UgBy+ahNje74u9Xi6B8FpgTyk3TbeRuUg4vSDZBNDilK6vDtJuCsD8qeqcq+Dy1SP6SZX0 ejdQesoIGnMcLwqXq5LSHzYSqasbQeMA5b0uMpmduIQn1lAtzkCb0VCnp4yy1XNcVLMpveBBSLPqa CSS0SAzqNfMhU7tgveoDtlGHD7Qon3cuMIjW1teqOy4W9IGZBwBAAyWNSXnAblKYYa3OJUErzkmGJ poFvWkQn7aH/Hz+1d9rw==; 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 1gAARY-0008FB-8W; Wed, 10 Oct 2018 09:06:12 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAANa-000545-S9; Wed, 10 Oct 2018 09:02:19 +0000 Received: by mail-lf1-x144.google.com with SMTP id r191-v6so3378658lff.2; Wed, 10 Oct 2018 02:01:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TA2hMcCsbnh1Gd9P/xX1f3LeZx7iF3o9MbmxqKWAyAk=; b=GAUp9Mt9TeIwF5R3rhnYGJUHDiV1Qz/t25mpiYrjA7PbOKKMSHW7EKhtkKOpWCUhAf PgXHrmRcHzz/LkNWkS0Zkh7Ip7iuvohCFqt6tYxsCXYLJWI2G+hSjPwuaoYZAAuLc8d8 2bzul8GgZQpSk99e0+gRxhVqAs7Gkm8N3ogKc7HjOhktzC37/It4mMM109Vkeo4f5rG3 cTrhEBW6eEf+rPrhaJRpd+YyvvKyVkCpvBipg5TlFCICCqGH1ZoAUqnfQeEOAzEUtXqv 6tSMzRpzKvIuxBH2LPEAhxPEHQQitXWv6dMYnlC3031bXaoRn35v6V3TwLKH1W9zJ9dh wyrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TA2hMcCsbnh1Gd9P/xX1f3LeZx7iF3o9MbmxqKWAyAk=; b=bpVcoIXKn5JQtJN5I/1lDHEGohLo0xtTWC7uj7NeigosYXQJLG9hNbK2Epq//n2CCy Ne/I/8E+2lEBeL+XRpt5I8eloJ5gQVoPR+g8x9UscJcFQZqV0IJ9s9OH5OoPL1eHDh/X DlXsPwgScrs9AV+tsOrSd2nIRylgfLX660RpajqJ1XbEYBDCC04UpqVIgK4VRZgf6byz x/JxZFwrKLNDaIAeJw2NCyCQTY+bvilNtLT/Mw6LAunJ0nOnK/QSzRyf4vGOLZOcQRP2 V8+bjrEG2EQodG0of7Ms2BHo16KnicIGKAfXyyrVSF56y3h7gkzp3PVMkW3Mw2mdLZRw nW7g== X-Gm-Message-State: ABuFfojFRWnE42WuyIl7XCuAzceO/0ZgTnjcXWmvg2CZDfOkQFEWxaZ0 smfzo3Y0sfOjHGSUccXL7UwNBNbk9B8= X-Google-Smtp-Source: ACcGV60ge1yDJBedeGV3xpRir0WlnArmlOXWPzpPwkVMFxN7nAgLmV0NdMd+s4oszuybspptIpmt7A== X-Received: by 2002:a19:5205:: with SMTP id m5-v6mr17373907lfb.68.1539162114515; Wed, 10 Oct 2018 02:01:54 -0700 (PDT) Received: from localhost.localdomain ([5.57.50.195]) by smtp.gmail.com with ESMTPSA id q2-v6sm2150078lfc.67.2018.10.10.02.01.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 02:01:53 -0700 (PDT) From: Emil Renner Berthing To: linux-rockchip@lists.infradead.org Subject: [PATCH 5/7] spi: rockchip: mark use_dma as bool Date: Wed, 10 Oct 2018 11:00:36 +0200 Message-Id: <20181010090038.20834-6-kernel@esmil.dk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181010090038.20834-1-kernel@esmil.dk> References: <20181010090038.20834-1-kernel@esmil.dk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_020206_951338_19A99923 X-CRM114-Status: GOOD ( 13.16 ) 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: Mark Rutland , devicetree@vger.kernel.org, Randy Li , Emil Renner Berthing , Brian Norris , Douglas Anderson , Rob Herring , linux-kernel@vger.kernel.org, Chris Zhong , Nickey Yang , Mark Brown , Klaus Goger , Enric Balletbo i Serra , linux-spi@vger.kernel.org, Shunqian Zheng , linux-arm-kernel@lists.infradead.org, Heiko Stuebner 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 The driver data has a u32 field use_dma which is only ever used as a boolean, so change its type to reflect that. Signed-off-by: Emil Renner Berthing --- drivers/spi/spi-rockchip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 85358f96f78f..1d8bf45304a5 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -202,7 +202,7 @@ struct rockchip_spi { bool cs_asserted[ROCKCHIP_SPI_MAX_CS_NUM]; - u32 use_dma; + bool use_dma; struct sg_table tx_sg; struct sg_table rx_sg; struct rockchip_spi_dma_data dma_rx; @@ -631,9 +631,9 @@ static int rockchip_spi_transfer_one( /* we need prepare dma before spi was enabled */ if (master->can_dma && master->can_dma(master, spi, xfer)) - rs->use_dma = 1; + rs->use_dma = true; else - rs->use_dma = 0; + rs->use_dma = false; rockchip_spi_config(rs); From patchwork Wed Oct 10 09:00:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Renner Berthing X-Patchwork-Id: 10634245 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 46CA216B1 for ; Wed, 10 Oct 2018 09:07:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C64829365 for ; Wed, 10 Oct 2018 09:07:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F5EB29693; Wed, 10 Oct 2018 09:07:19 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 ADDF329365 for ; Wed, 10 Oct 2018 09:07:18 +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=akXZBS/EOJHQSfrEPYtO5MXfog1pkoSh5H0j2rxalHE=; b=My59wJfov8yalQ uoYHRzfu8agTQqOZ1rFIkEkdGB+H9z1xOYFPeMmZVZm3rBv/gbkPfoLbiv6G6cweHwl17nrNTWIZZ 3LypaFpOhJlXVt9u87OnhKVOP7V8DgY0ow7D2CRWQ5hRhy2U5VMI/CXElzQnVCj5HFWh1EXe8P2m1 0qNthCWfKzO6FfO+I8kcfuv2OyFnBaeWYLLILoz9Q9gQJB1sUgY3V4EzIqiRRwLgcZa4JsDUvZYTy VJzvLQbpIh9bs8S5yJByO4wDQZ7oumBzUuHuzwL3QiukOaL48P4DdIRWGBgams3cjsUFlSttarrm0 X+PkCNwZWu5BBxy8/EYA==; 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 1gAASP-0000Bd-4L; Wed, 10 Oct 2018 09:07:05 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAANa-00054I-S6; Wed, 10 Oct 2018 09:02:26 +0000 Received: by mail-lf1-x144.google.com with SMTP id a82-v6so3382267lfa.4; Wed, 10 Oct 2018 02:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H1wYnlUgcfpcHgJvA96w+RLcQIxhKmNVE/gaATftEyo=; b=YX8ftzhcGVUtGMcOs/GPlyGJsTa82qCFw1D3W72YFq761h+2Hsr0RJjEH4sTqiK1l5 v66ua5nUCMbl9V65AVPwJnGWwNaMzV55W52ry4HBkPOTOmx/OFwfC2ZPDPifnmhLtNbK +ix1bDrDrt6hqrrXKV/KXjNrKDfZl/dYalW01ivXIjxvGfVSEm5QXWjv14Qe2zvZDb+W xBy260e4sAtaXzV+WZB9lH0llVpqM7uKHQXaSRSwCLNZbZ6tbQXrBwLY+09RWml29U9s wSak9hExeKWvRovax5RBq/C7PiEbI+dAltZFngsZER4OlJ0rcIa8+Hd410GO6zICp1z8 GnSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=H1wYnlUgcfpcHgJvA96w+RLcQIxhKmNVE/gaATftEyo=; b=Edl/igulj3L1rD0tfb+dxnXezcQUFru2LCAp4TzmfKBaLLFA/yPZ4iyIlhL0FGnqyz y1FG6PCv4Fj31yKvTu8lP+anTYjkrakir7KHfpe6DDy8OS2mRx/9FncMsyz7aFrCq7n/ IXF6nXRdOPowggccbVrNiLzHnBzMxYNfzCW3/wdgBdWiX/t6NHiP/tHMcQB5Zr22QukH 2CUAbsVl4dzDC369cMN9KsGDl4Rhwz+r8PPnT3ofQg2fYCs0ekqIhnN5UX+6Vpm7AKFw kq8A2lV4GlH0xFmBSmMnCgavMU8zRfZdtL6hUol1jB0myG962kFHfI6ldkiwM6G5ic8h YgEg== X-Gm-Message-State: ABuFfojxM8kOuvh0pXBPr5rHlc2kscs3zcEWgmcrvYXqlEnReDm8pcnG Mjresf0d3Uwm9R2tEsLP2ni245m/I5Y= X-Google-Smtp-Source: ACcGV61n5/KgpPFjcr0D0nPzvbXlF4T9M+zjt0qq3dmcy0RcqcjAxHXWT86QY0K2fc8AGUc8OYuTqw== X-Received: by 2002:a19:5e5d:: with SMTP id z29-v6mr17336105lfi.110.1539162116518; Wed, 10 Oct 2018 02:01:56 -0700 (PDT) Received: from localhost.localdomain ([5.57.50.195]) by smtp.gmail.com with ESMTPSA id q2-v6sm2150078lfc.67.2018.10.10.02.01.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 02:01:55 -0700 (PDT) From: Emil Renner Berthing To: linux-rockchip@lists.infradead.org Subject: [PATCH 6/7] spi: rockchip: directly use direction constants Date: Wed, 10 Oct 2018 11:00:37 +0200 Message-Id: <20181010090038.20834-7-kernel@esmil.dk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181010090038.20834-1-kernel@esmil.dk> References: <20181010090038.20834-1-kernel@esmil.dk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_020206_947020_CA378E84 X-CRM114-Status: GOOD ( 12.20 ) 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: Mark Rutland , devicetree@vger.kernel.org, Randy Li , Emil Renner Berthing , Brian Norris , Douglas Anderson , Rob Herring , linux-kernel@vger.kernel.org, Chris Zhong , Nickey Yang , Mark Brown , Klaus Goger , Enric Balletbo i Serra , linux-spi@vger.kernel.org, Shunqian Zheng , linux-arm-kernel@lists.infradead.org, Heiko Stuebner 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 The dma direction for the tx and rx dma channels never change, so just use the constants directly rather than storing them in device data. Signed-off-by: Emil Renner Berthing --- drivers/spi/spi-rockchip.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 1d8bf45304a5..1044849a352d 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -164,7 +164,6 @@ enum rockchip_ssi_type { struct rockchip_spi_dma_data { struct dma_chan *ch; - enum dma_transfer_direction direction; dma_addr_t addr; }; @@ -454,7 +453,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) rxdesc = NULL; if (rs->rx) { - rxconf.direction = rs->dma_rx.direction; + rxconf.direction = DMA_DEV_TO_MEM; rxconf.src_addr = rs->dma_rx.addr; rxconf.src_addr_width = rs->n_bytes; rxconf.src_maxburst = 1; @@ -463,7 +462,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) rxdesc = dmaengine_prep_slave_sg( rs->dma_rx.ch, rs->rx_sg.sgl, rs->rx_sg.nents, - rs->dma_rx.direction, DMA_PREP_INTERRUPT); + DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT); if (!rxdesc) return -EINVAL; @@ -473,7 +472,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) txdesc = NULL; if (rs->tx) { - txconf.direction = rs->dma_tx.direction; + txconf.direction = DMA_MEM_TO_DEV; txconf.dst_addr = rs->dma_tx.addr; txconf.dst_addr_width = rs->n_bytes; txconf.dst_maxburst = rs->fifo_len / 2; @@ -482,7 +481,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) txdesc = dmaengine_prep_slave_sg( rs->dma_tx.ch, rs->tx_sg.sgl, rs->tx_sg.nents, - rs->dma_tx.direction, DMA_PREP_INTERRUPT); + DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); if (!txdesc) { if (rxdesc) dmaengine_terminate_sync(rs->dma_rx.ch); @@ -778,8 +777,6 @@ static int rockchip_spi_probe(struct platform_device *pdev) if (rs->dma_tx.ch && rs->dma_rx.ch) { rs->dma_tx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_TXDR); rs->dma_rx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_RXDR); - rs->dma_tx.direction = DMA_MEM_TO_DEV; - rs->dma_rx.direction = DMA_DEV_TO_MEM; master->can_dma = rockchip_spi_can_dma; master->dma_tx = rs->dma_tx.ch; From patchwork Wed Oct 10 09:00:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Renner Berthing X-Patchwork-Id: 10634247 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 C316116B1 for ; Wed, 10 Oct 2018 09:07:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2B58295B3 for ; Wed, 10 Oct 2018 09:07:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3E59296B5; Wed, 10 Oct 2018 09:07:49 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 5151A295B3 for ; Wed, 10 Oct 2018 09:07:49 +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=Uf262ZrnQTWgZ1yV6tC4RumNzduMJtR4s4PzBUJ1RzU=; b=mPbvVZVVloft+K vpV7UbbpbC1VTiB+DKHPK4ttq27EgNGN4G4fh9w9rDSO9IOHVpJr6F7ja6t8v9L1s4LbwGNlfTbBx dW8lpX4DtHzcjzaC+h4ZCizDUiWOMmtcVzOXaofjwsClN/22kVPivzokQ+hBPCKdQ+XLO7AKBQdl4 Q5lX6FjbwTGrci6nU8d8IZ+YFx2cmCXqoVjXoB/ue09lK4Ku0kCaxj8DfTFA22Q8xwtXJ3F3gYaeT 7hdC6PWSUamDhq7vKfzWSzNa7Zvhckjdy5sgFrSXKG7bllZp2m6OcIvA9q5pZOBuYR7ZI7OJKGc7x VK7J+iMA7fP/GHY/PtwQ==; 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 1gAAT2-0000XQ-I3; Wed, 10 Oct 2018 09:07:44 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAANg-00055R-AH; Wed, 10 Oct 2018 09:02:27 +0000 Received: by mail-lj1-x244.google.com with SMTP id j4-v6so4138907ljc.12; Wed, 10 Oct 2018 02:02:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ePO3J3Hd1Gc2W0qvUwMkU3g/clFK2S8VRj/cGZ2vxiw=; b=Wxz8jkliERYElnGwco0K1Yl3iGzfsXj1A1nhCiMSDG2jJDcmROdr+v1l466HUGXA2b T2J5pIYfiR6DmIWam1BCK0O86kUSeG6RvwAS125CFjUdu1cmvowqxjjLgsQvnTqgOLUN CDQpo3IETcxu1pHstWUkJEGtKHpppn9OZDhDbqKMpFdAMKv8EYE/4wM5AquM7eUed/bX VzEJZvQMAkzwRFTo3RQtSw9AtYpqyIj0Q0LTXl7DU93f2R6pTmFCNQJ0GsTh2IyJOKXY lQI7wEMi0PEhqvp7Ma/tutMg7mm9lGEijM6KhuhTW4HFGo4bOc6yDKxrYyRHZj6fQLok lSBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ePO3J3Hd1Gc2W0qvUwMkU3g/clFK2S8VRj/cGZ2vxiw=; b=fKDJpHV3C4/Ai4qNxvQT721KwDoH7OpNr/UzLh2O/GUo3OCBifZAMoJMHn4e8GaZOQ 3LVC/ohm51nE0fr1VIXVn6UNyoCv150ep0iYS7WhNLYPEN7UeOEXvXem0cFHcYRNk8yM FsDQkjys4SHXAAkIIm4n4MzGNzo88hiwiEOGGeex0irGi4XVFdw3abyqQ6qWnNf5QmmS kTmFNfxPi1hTzp7g9TqsbUjmZ54NEBT+f9Q+02F3eWoFAQmDrdceoEX0HF+GRb2Zs4Da eyK1IVoI82CnKhmSjGdL76dYQuYiH1RAFQyNWrqw5xhWBQR/+Em5/cTudtqNz6CYXPXP Uijg== X-Gm-Message-State: ABuFfogchXEo1hDrbTA4vJfQ/+FQKu4OQnaVaRKyXqGhI6pl9oxejwyQ +szxHnO4r99FuSDSK5e740h8V2Jyqas= X-Google-Smtp-Source: ACcGV61nKTMOfdCLyjWnbZfNQtan8+VXTMd/XDXAk6gvoVrlKz8lXWMJaK4qzuOaDYpiy96WzPnBCg== X-Received: by 2002:a2e:5c89:: with SMTP id q131-v6mr21223531ljb.119.1539162118533; Wed, 10 Oct 2018 02:01:58 -0700 (PDT) Received: from localhost.localdomain ([5.57.50.195]) by smtp.gmail.com with ESMTPSA id q2-v6sm2150078lfc.67.2018.10.10.02.01.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 02:01:57 -0700 (PDT) From: Emil Renner Berthing To: linux-rockchip@lists.infradead.org Subject: [PATCH 7/7] spi: rockchip: simplify spi enable logic Date: Wed, 10 Oct 2018 11:00:38 +0200 Message-Id: <20181010090038.20834-8-kernel@esmil.dk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181010090038.20834-1-kernel@esmil.dk> References: <20181010090038.20834-1-kernel@esmil.dk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_020212_388265_30773AC5 X-CRM114-Status: GOOD ( 15.30 ) 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: Mark Rutland , devicetree@vger.kernel.org, Randy Li , Emil Renner Berthing , Brian Norris , Douglas Anderson , Rob Herring , linux-kernel@vger.kernel.org, Chris Zhong , Nickey Yang , Mark Brown , Klaus Goger , Enric Balletbo i Serra , linux-spi@vger.kernel.org, Shunqian Zheng , linux-arm-kernel@lists.infradead.org, Heiko Stuebner 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 Let the dma/non-dma code paths handle the spi enable flag themselves. This removes some logic to determine if the flag should be turned on before or after dma and also don't leave the spi enabled if the dma path fails. Signed-off-by: Emil Renner Berthing --- drivers/spi/spi-rockchip.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 1044849a352d..51ef632bca52 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -379,6 +379,8 @@ static int rockchip_spi_pio_transfer(struct rockchip_spi *rs) { int remain = 0; + spi_enable_chip(rs, 1); + do { if (rs->tx) { remain = rs->tx_end - rs->tx; @@ -501,6 +503,8 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) dma_async_issue_pending(rs->dma_rx.ch); } + spi_enable_chip(rs, 1); + if (txdesc) { spin_lock_irqsave(&rs->lock, flags); rs->state |= TXBUSY; @@ -509,7 +513,8 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) dma_async_issue_pending(rs->dma_tx.ch); } - return 0; + /* 1 means the transfer is in progress */ + return 1; } static void rockchip_spi_config(struct rockchip_spi *rs) @@ -592,7 +597,6 @@ static int rockchip_spi_transfer_one( struct spi_device *spi, struct spi_transfer *xfer) { - int ret = 0; struct rockchip_spi *rs = spi_master_get_devdata(master); WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && @@ -636,24 +640,10 @@ static int rockchip_spi_transfer_one( rockchip_spi_config(rs); - if (rs->use_dma) { - if (rs->tmode == CR0_XFM_RO) { - /* rx: dma must be prepared first */ - ret = rockchip_spi_prepare_dma(rs); - spi_enable_chip(rs, 1); - } else { - /* tx or tr: spi must be enabled first */ - spi_enable_chip(rs, 1); - ret = rockchip_spi_prepare_dma(rs); - } - /* successful DMA prepare means the transfer is in progress */ - ret = ret ? ret : 1; - } else { - spi_enable_chip(rs, 1); - ret = rockchip_spi_pio_transfer(rs); - } + if (rs->use_dma) + return rockchip_spi_prepare_dma(rs); - return ret; + return rockchip_spi_pio_transfer(rs); } static bool rockchip_spi_can_dma(struct spi_master *master,