Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5142805imm; Sun, 22 Jul 2018 14:21:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfOV6W+UqRk1pmqOXRA2Xrpfm+BTqWSyo2FkfHOM+cARQodLI8/xTv5l5LnItP4rEjOebyG X-Received: by 2002:a63:1902:: with SMTP id z2-v6mr9542302pgl.86.1532294517708; Sun, 22 Jul 2018 14:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294517; cv=none; d=google.com; s=arc-20160816; b=xtldaWditWqae7ckJNGtNab8CC3YmGxTJJfYMO6MCAw50+3JIV6P9Y3BDA5oamNm4E aUwYL1udG2Qeh66sZd9+h8tZKjWt3Ng5KIXYdb9VNyM/AbXpcxGSOQO13aFGPfSliquQ 3j0cJZT8s6no07PwH8t2IUHloxse+G/JtUO5aBDeN0S9IzXYWexjeDDnbI8Jdwxvr1Qr sY3c4eoQZzprdLs0lPF3fmux+SNHeu/ch6PItaGIQvct89LgbPdeQxMdGpqzGCwfUJ5o kC7Mo9bs16HigfWd3Mmb8vRCoNQ3bc4yREWS0HVjO05t/iBMEN5mNig2x5mQE/9H/jRv yv1g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=lWb+Ji1RVyMn0O+37665Pw9e07fK6MV0NWV2k2KQucI=; b=Yw+oKkg4MhwcmUmq77RllcW3qIhnSblN0BaMNW85+AoUBWrAO3op+P9PEvXv+hLw25 dSxoJW7bYhjVT2Qvv0MWlCKGCKYFRNF6zTQ1GqmOEW6V8RjcDdHbGiz6kFxTJb5FPfX4 Gx1Y9GReIGn7Itq/TRbxml7Pfbc6IMacFbjIGopd/5Zk2KqWRJX6A6EX+R1NnXhAx01i GYpQ/V/sBrtSIOPILzabiBr8pkxtUrkzxjP0lLEd/wU3bhnNCzKRgZkmoCv4DQD4jjTI 3Bo3W6wRe9BfmUCO4nS4gvw3ZVIVyOt0VWM6ogg+bgUhH3XB+MFk1UvXf+nRx3WvjgPA VgCQ== ARC-Authentication-Results: i=1; mx.google.com; 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 8-v6si6542785plc.160.2018.07.22.14.21.43; Sun, 22 Jul 2018 14:21:57 -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; 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 S2387859AbeGVWS0 (ORCPT + 99 others); Sun, 22 Jul 2018 18:18:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:38804 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387794AbeGVWSZ (ORCPT ); Sun, 22 Jul 2018 18:18:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 91399AFD6; Sun, 22 Jul 2018 21:20:23 +0000 (UTC) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, Ionela Voinescu , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Mark Brown , linux-spi@vger.kernel.org Subject: [PATCH 13/15] spi: img-spfi: RX maximum burst size for DMA is 8 Date: Sun, 22 Jul 2018 23:20:08 +0200 Message-Id: <20180722212010.3979-14-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> 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 From: Ionela Voinescu The depth of the FIFOs is 16 bytes. The DMA request line is tied to the half full/empty (depending on the use of the TX or RX FIFO) threshold. For the TX FIFO, if you set a burst size of 8 (equal to half the depth) the first burst goes into FIFO without any issues, but due the latency involved (the time the data leaves the DMA engine to the time it arrives at the FIFO), the DMA might trigger another burst of 8. But given that there is no space for 2 additonal bursts of 8, this would result in a failure. Therefore, we have to keep the burst size for TX to 4 to accomodate for an extra burst. For the read (RX) scenario, the DMA request line goes high when there is at least 8 entries in the FIFO (half full), and we can program the burst size to be 8 because the risk of accidental burst does not exist. The DMA engine will not trigger another read until the read data for all the burst it has sent out has been received. While here, move the burst size setting outside of the if/else branches as they have the same value for both 8 and 32 bit data widths. Signed-off-by: Ionela Voinescu Signed-off-by: Andreas Färber --- drivers/spi/spi-img-spfi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c index 231b59c1ab60..8ad6c75d0af5 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c @@ -346,12 +346,11 @@ static int img_spfi_start_dma(struct spi_master *master, if (xfer->len % 4 == 0) { rxconf.src_addr = spfi->phys + SPFI_RX_32BIT_VALID_DATA; rxconf.src_addr_width = 4; - rxconf.src_maxburst = 4; } else { rxconf.src_addr = spfi->phys + SPFI_RX_8BIT_VALID_DATA; rxconf.src_addr_width = 1; - rxconf.src_maxburst = 4; } + rxconf.src_maxburst = 8; dmaengine_slave_config(spfi->rx_ch, &rxconf); rxdesc = dmaengine_prep_slave_sg(spfi->rx_ch, xfer->rx_sg.sgl, @@ -370,12 +369,11 @@ static int img_spfi_start_dma(struct spi_master *master, if (xfer->len % 4 == 0) { txconf.dst_addr = spfi->phys + SPFI_TX_32BIT_VALID_DATA; txconf.dst_addr_width = 4; - txconf.dst_maxburst = 4; } else { txconf.dst_addr = spfi->phys + SPFI_TX_8BIT_VALID_DATA; txconf.dst_addr_width = 1; - txconf.dst_maxburst = 4; } + txconf.dst_maxburst = 4; dmaengine_slave_config(spfi->tx_ch, &txconf); txdesc = dmaengine_prep_slave_sg(spfi->tx_ch, xfer->tx_sg.sgl, -- 2.16.4