Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10084504ybi; Wed, 24 Jul 2019 15:40:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/5mqqNGeJphJHNTUFZhETxtBCbXg9sjCqEbN7/CN/JCtn1EdCsOYEosG6t1z9xafezH94 X-Received: by 2002:a17:90a:1ac5:: with SMTP id p63mr88051767pjp.25.1564008004866; Wed, 24 Jul 2019 15:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564008004; cv=none; d=google.com; s=arc-20160816; b=fYk+Ki/bO9Ufmlj41P0/i5ws61UaEvffktQ1dyJr02YNBpyVxGi62T5bPq5NC6Agbn ihsErBmyro8S6Gu8BVX4S6WyKTgzorJCObSSVkwMrAQT/ZMt0+ozwSh6kjWZ95zvxZ8Z R0wzJLAvKXsYmwJ5lK2nDiHXEO/5BRxDg2JO2B+xL6WLAHFduM5ScdLR+9RIgutuDXKv RFIyynXXK7Dm7gZoksKEiXiYBEgIGTUIxxKMnvjUDaXyWgat9vUHYbEEVn5yIdR/vMzW eDyk1IQMUyCGqG47hN2zyHWPh3ijk+SuQYv/YbVor5IUc/LUQZv2jDBF7hWj4MLoizmA EJRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XvGSGOkQchC63KTf85N8ZEU4Z42I7JMh2viudgyzHhw=; b=LaNhVxbIwjWgg4XJlUdNAeYNB7z63WWXB5oRaUPO++gNiPzpo1/m8hfyfXk/lWmMnN jz3HbB1NcMKT+Hrw6BF8J3WljwVMXoILMbIr0IoqVmqokGhz8MBQQaf2bYj6FjlbD8Hl mAMLTVxjWeXy5BYVzhhb9/bZkVwuOgNS6Y2/P+NxTJMNmpDzMYKy/RXWaxjDSmeXsYo9 WUGq/ZX7R1OhUNC3nrnAVigZePE4qpMEw4ur1cnve4eSfqNWCS9ZDLOufyx6GIarv00v uQngAvmpx1tXuB4OeIqVAZ3fhyH3JnjyexZ7CjbTaJvzF+SwxxhiLxuMk2Q70ZRRyvJq rtLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HEkWgBAe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1si17694529pff.73.2019.07.24.15.39.49; Wed, 24 Jul 2019 15:40:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HEkWgBAe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729047AbfGXTYV (ORCPT + 99 others); Wed, 24 Jul 2019 15:24:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:40458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729032AbfGXTYT (ORCPT ); Wed, 24 Jul 2019 15:24:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 911B8218EA; Wed, 24 Jul 2019 19:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996258; bh=gMMurKYMCG8pPeWNb5igVlclR8pt7aNHttM/JyzjUzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HEkWgBAee5cydfjW3Oy2bWuxxt3t5S6Qzm67JZ4lY71HAZTenIPHww/IIED0eCW56 euivorDLM3Zs5W/V8Je1SKywWKtkDeieU70DrapgF6yBr1WILJMFTXrUYLIByu+adZ rdMHq7o0drxZHmUFfzAcWHFSNsjQW0qFMwKowUow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emil Renner Berthing , Mark Brown , Sasha Levin Subject: [PATCH 5.2 007/413] spi: rockchip: turn down tx dma bursts Date: Wed, 24 Jul 2019 21:14:58 +0200 Message-Id: <20190724191735.754597361@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 47300728fb213486a830565d2af49da967c9d16a ] This fixes tx and bi-directional dma transfers on rk3399-gru-kevin. It seems the SPI fifo must have room for 2 bursts when the dma_tx_req signal is generated or it might skip some words. This in turn makes the rx dma channel never complete for bi-directional transfers. Fix it by setting tx burst length to fifo_len / 4 and the dma watermark to fifo_len / 2. However the rk3399 TRM says (sic): "DMAC support incrementing-address burst and fixed-address burst. But in the case of access SPI and UART at byte or halfword size, DMAC only support fixed-address burst and the address must be aligned to word." So this relies on fifo_len being a multiple of 16 such that the burst length (= fifo_len / 4) is a multiple of 4 and the addresses will be word-aligned. Fixes: dcfc861d24ec ("spi: rockchip: adjust dma watermark and burstlen") Signed-off-by: Emil Renner Berthing Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-rockchip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 9b91188a85f9..2cc6d9951b52 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -417,7 +417,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs, .direction = DMA_MEM_TO_DEV, .dst_addr = rs->dma_addr_tx, .dst_addr_width = rs->n_bytes, - .dst_maxburst = rs->fifo_len / 2, + .dst_maxburst = rs->fifo_len / 4, }; dmaengine_slave_config(master->dma_tx, &txconf); @@ -518,7 +518,7 @@ static void rockchip_spi_config(struct rockchip_spi *rs, else writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_RXFTLR); - writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_DMATDLR); + writel_relaxed(rs->fifo_len / 2, rs->regs + ROCKCHIP_SPI_DMATDLR); writel_relaxed(0, rs->regs + ROCKCHIP_SPI_DMARDLR); writel_relaxed(dmacr, rs->regs + ROCKCHIP_SPI_DMACR); -- 2.20.1