Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5108082imu; Tue, 29 Jan 2019 12:57:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN4C5vdiJERtXg8Y4wG7ZHSWw0LgSkc81ycsPMXkMXAbammtzTbSJyn3KM0X0IRs1Rjm8Sx3 X-Received: by 2002:a63:c00b:: with SMTP id h11mr25586953pgg.429.1548795442733; Tue, 29 Jan 2019 12:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548795442; cv=none; d=google.com; s=arc-20160816; b=t1yzWXIYKKGImdSCG8QYoqppl8GTCw0AdcbJTHb5TLm/1LOAKUCWCaJKypnRMvrWG4 Qz+46i6ty5c6OHFjI/uQHPTJYfzgQ0MXXC6nkRDSqr4fMpQLiHPi8tBkzGjKXCNEOFS3 WY9RSyDNonRrs/dIR4RHjPCuLrTITuB9UbqMnsML1N7wSFmeOy4V5gi0EY0BbMeKhY1G zPv1nKmxX3bSoY7Ovc5ZT8ULgMFZIoJEXhHRx4ILF0KatKZaTNtlroiHdXGwz8Pg9+n5 JZ+NMCv9KF1iRE4OyxAb25mIyGzAKJv1l56gDbnlCl/Kqjb54iqrLQKFp3dokfXMHgKR uEOg== 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 :dkim-signature; bh=Adu7r7feIgD220eJhrZ8nREsuxr7WzIV5vIaaUUOmX8=; b=X21esA+OF2R7o5+RU0smO3CfZCC4E1AJpZi0vP7Pj2MhHvtGcl5fnGrizX1DMxXRlg AqK1xpweFAEcqxcvoH3+3nkolpCiILcEJH6ysE60ElgTAIAZKyFzggZ4Vz67/rGiM+36 zn8y9JY3ML2KB9ZhuaCib0ySm/ZyBSMlHu2dQ+MNm3SqA1OO1noEHDzqEScbDKYyXAJN dNoMJ+L4eeJ18Nxtu1b2yU+gK19/v0RmoquvVGlLwaLEmUUgoO/PV4EEVUXwMJDDOenw ztK1vK+4a2ufa7pivltoQwZBJT+iZilHEHv49lJGuOuVSKKJCH4wKDhLGkk+Yb9jUFkk XQ3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@norrbonn-se.20150623.gappssmtp.com header.s=20150623 header.b=R2s3ESfn; 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 r12si2708699pgf.22.2019.01.29.12.57.07; Tue, 29 Jan 2019 12:57:22 -0800 (PST) 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=@norrbonn-se.20150623.gappssmtp.com header.s=20150623 header.b=R2s3ESfn; 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 S1729567AbfA2UzR (ORCPT + 99 others); Tue, 29 Jan 2019 15:55:17 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:35760 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729516AbfA2UzK (ORCPT ); Tue, 29 Jan 2019 15:55:10 -0500 Received: by mail-lf1-f66.google.com with SMTP id e26so15722503lfc.2 for ; Tue, 29 Jan 2019 12:55:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=norrbonn-se.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Adu7r7feIgD220eJhrZ8nREsuxr7WzIV5vIaaUUOmX8=; b=R2s3ESfnLLcxPKelxgl+NXEG8xnvOoijCdQhE07518wuxwwp0VMih0qBEWxulr+AsV q6sFN/bNB/N+ZAoRy5S/+rJDQOR4bMFDOVunBdWem8tPCRvchZt0Gk9QMyS6vRV6+9vU HFnDNPmjjWj/revgDQRb9LK2xRBiPB8dFhr2T1VEVB/1xEBB9s42JNyRyrozyTwy5bqI 6nDwfnhs1c8RofkvOYeGxPAnrs+yMnif1a1pSa0R19GVUL/oi7YgREisDqDUa7wbUUYH pKdL2rxbl/m6EYvYhVaZpAh6YmM3SkDS1TBXXYXDi2tWQ7jjP+Yv/6QKPr4SRiG6g1gO 38pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Adu7r7feIgD220eJhrZ8nREsuxr7WzIV5vIaaUUOmX8=; b=f0ldbuhLua4872/CIePNeMDwtMaeju2eidhgJdfSxAq17l3hIsxWhJB3VV5aI957Dk Wbb8m7hl2zsBZIkiNDhY0gLifZ8bmW98Qnz4CScKLPRSfZ1/bjAUb3C0q0uGdiA9XfmF EdjlAaUNoWOucps5bKYxVclo2Wk8F+88xhs/FKsws97y/Abx/zufvxuwpZpH1tq8XqHH s/922yPMlkbu1RWLGf2hzotY2/teI8WJct6wkZoR4sWbKA0PbxJvy7N7kkBCCav9Jmzv Q3KKkNabQ8plTfl4Er0H2YZ0LgC7JAP/T0WzJtaQU7BjC6nWRRksiG4ZlxUhxjUV3B8r EpHw== X-Gm-Message-State: AJcUukeIjhQViDKJtK4Tf64XagTNUuiGewsafRU+D4xqD3fVx9vQtCqY 16fFbvlFKble6aLaz/O/uOP3JzC1iis= X-Received: by 2002:a19:980f:: with SMTP id a15mr21220369lfe.103.1548795307852; Tue, 29 Jan 2019 12:55:07 -0800 (PST) Received: from mimer.lan (h-29-16.A159.priv.bahnhof.se. [79.136.29.16]) by smtp.gmail.com with ESMTPSA id o17sm3677287lff.77.2019.01.29.12.55.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 12:55:07 -0800 (PST) From: Jonas Bonn To: linux-kernel@vger.kernel.org Cc: Jonas Bonn , Nicolas Ferre , Mark Brown , Alexandre Belloni , Ludovic Desroches , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 2/2] spi-atmel: support inter-word delay Date: Tue, 29 Jan 2019 21:55:02 +0100 Message-Id: <20190129205502.7741-3-jonas@norrbonn.se> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190129205502.7741-1-jonas@norrbonn.se> References: <20190129205502.7741-1-jonas@norrbonn.se> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the SPI slave requires an inter-word delay, configure the DLYBCT register accordingly. Tested on a SAMA5D2 board (derived from SAMA5D2-Xplained reference board). Signed-off-by: Jonas Bonn CC: Nicolas Ferre CC: Mark Brown CC: Alexandre Belloni CC: Ludovic Desroches CC: linux-spi@vger.kernel.org CC: linux-arm-kernel@lists.infradead.org --- drivers/spi/spi-atmel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index f53f0c5e63da..57cc7110f9e8 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1201,13 +1201,14 @@ static int atmel_spi_setup(struct spi_device *spi) csr |= SPI_BIT(CSAAT); /* DLYBS is mostly irrelevant since we manage chipselect using GPIOs. - * - * DLYBCT would add delays between words, slowing down transfers. - * It could potentially be useful to cope with DMA bottlenecks, but - * in those cases it's probably best to just use a lower bitrate. */ csr |= SPI_BF(DLYBS, 0); - csr |= SPI_BF(DLYBCT, 0); + + /* DLYBCT adds delays between words. This is useful for slow devices + * that need a bit of time to setup the next transfer. + */ + csr |= SPI_BF(DLYBCT, + (as->spi_clk / 1000000 * spi->word_delay_us) >> 5); asd = spi->controller_state; if (!asd) { -- 2.19.1