Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5638014imu; Wed, 30 Jan 2019 00:42:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN4yKxj4hI3iQYA+zpcI6FkrIN8kvPhCvo1Pm6pZT9+Hl9EqSmyvRGA1bbck/dnXuyNMH6ri X-Received: by 2002:a62:6385:: with SMTP id x127mr29997396pfb.15.1548837726438; Wed, 30 Jan 2019 00:42:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548837726; cv=none; d=google.com; s=arc-20160816; b=E2WBPfb55cETMgNyGktwyIFhTSBO69Gg/K5+pBr78FIk4ZLd1LYjtplV8YiRXtD48d VJusGvboDACp/tY8BstlM7N2phdcohzdSf6pbKhbJCZsO5wPoDk2WIgvlxdS61BAkdHf Uw1v0dmg/6MxtwEaQ1MbR0Cy3dmotlXAWP8SdONbZ2cEhC+rqI4ue0KW5E84nPphv6ZS H1xxv/uHNZC/QP/K/rt5YYIOWbhg2cfIW8UKNEdtHLMIXrRFWckVKgBOfxYwHCd6gOVM PdAiKg/I1R2PCu9XRBkCBTkXTAzPS3Idhm/Z2SIEJ9ZFY2+y/V8Fp8H7Vp/4KBU4fFfM egHA== 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=4YH1qzEHTsrJPYWTxDoTQQojGlkWsi2+2TPbuMpCJp8=; b=cgasN0C6wAc1FPFf/nG5nhU2n6uLMi9Byd9FLCe26vTILc9jkgCzlYYFr2jvx90T26 8MpUC7EU7i2u3uAVg2+ypjWBi/TEw+/5QIGqYcRH5TWggJ0efgfBWHwWf36FA8PPfNU4 zcXJ1U00m6J0MKxlVpPDuEwXFdQLow405dJlzoWW3wnbuOosE1LxfTx4xfgqATuxA+3V 16C77b+JiOA7lo3+LM5a1qRHudlSZruBQQml3GQ/5CUoO6lFMGFf399aH+KJOvBOZ3F+ AKJJzkPs2Z5GcwUcuGXNaF2SZkyZLM3bp1a+Zbspa7Wdfe8DITmPj3jtYVthlOHIr2Xc Lowg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@norrbonn-se.20150623.gappssmtp.com header.s=20150623 header.b=dmjrwl7a; 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 z186si866364pgd.90.2019.01.30.00.41.50; Wed, 30 Jan 2019 00:42:06 -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=dmjrwl7a; 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 S1730327AbfA3IkQ (ORCPT + 99 others); Wed, 30 Jan 2019 03:40:16 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:46665 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730272AbfA3IkN (ORCPT ); Wed, 30 Jan 2019 03:40:13 -0500 Received: by mail-lj1-f195.google.com with SMTP id v15-v6so19914916ljh.13 for ; Wed, 30 Jan 2019 00:40:12 -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=4YH1qzEHTsrJPYWTxDoTQQojGlkWsi2+2TPbuMpCJp8=; b=dmjrwl7a+PyLOExvhqVETNBsg9L2raflvETv36m3+TLSGt3mG1OxVjze34yNEZFGPn POiZGeCQ4b0ABoPEzKomDnavISSlV9FKY7MVqalDKzp1AUGVPxsIt1woChp3imUwnz2G J1sdUj0q709LDqQmI5ViUIxnL7BGtHdVX32/joz7AW63jDiVoksYsJHJJXBppVuLXvAj kr07AqrIhJY5dQRVILRQg68DSN7vFRPdsiKziasuu7OweOEcZIM7ijPHSASBG9tqeDUq FA3hHamxpp5vrOYKjqu1GQYkxYoaKyYzGAiS2B1mt/jwo6JMF1zL2mJ0tt9O1cDVTz4e DAaA== 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=4YH1qzEHTsrJPYWTxDoTQQojGlkWsi2+2TPbuMpCJp8=; b=VAYg2aHZKeMj3vUTMG635n3+E57v8Zjlk9CP9UqhiHVwKowVRu80LvEx+BmO3KR2DO Qb23pJEO5XQV7v+ucxuScMXBMs/dpEEDM7Et+L+RvO5dMt0fQgsURKoLbzbvWU3Zqi/s 7hx/HEo/Wixaem47f4ikC4vKGrrv28HEFNbftRZbiotoR2S3IxTRb7cJROvd8/vt7ou9 9KkHZuzfhSuK54baq1nBO0ANNmLlC3IQ9ggdBbvtPCIqv4RtwWU3PylFjjBCVd6f5zjy yQmEgW/BKL/Hz8b9O3kk7WPSOg93rdj+v0OEz05KoSSSKNdW22i1QwkM77PkoBFU+pJZ c7cw== X-Gm-Message-State: AJcUukcIlsogQFqYPK37hR3ZKT74HG8hG4XKvIrUaXlER3w8/jy/jbEY T1PMTrY19MQPch1WBOR/2ECeak5o3AU= X-Received: by 2002:a2e:8087:: with SMTP id i7-v6mr23266267ljg.179.1548837611033; Wed, 30 Jan 2019 00:40:11 -0800 (PST) Received: from mimer.lan (h-29-16.A159.priv.bahnhof.se. [79.136.29.16]) by smtp.gmail.com with ESMTPSA id q67sm176734lfe.19.2019.01.30.00.40.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jan 2019 00:40:10 -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 v6 2/2] spi-atmel: support inter-word delay Date: Wed, 30 Jan 2019 09:40:05 +0100 Message-Id: <20190130084005.18649-3-jonas@norrbonn.se> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190130084005.18649-1-jonas@norrbonn.se> References: <20190130084005.18649-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 Acked-by: Nicolas Ferre 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..4954f0ab1606 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_usecs) >> 5); asd = spi->controller_state; if (!asd) { -- 2.19.1