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);