From patchwork Wed Jan 30 08:40:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Bonn X-Patchwork-Id: 10787867 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 43F9291E for ; Wed, 30 Jan 2019 08:40:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B5BE2E419 for ; Wed, 30 Jan 2019 08:40:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FCF52E459; Wed, 30 Jan 2019 08:40:24 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B45632DFEA for ; Wed, 30 Jan 2019 08:40:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728193AbfA3IkN (ORCPT ); Wed, 30 Jan 2019 03:40:13 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:41354 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726452AbfA3IkN (ORCPT ); Wed, 30 Jan 2019 03:40:13 -0500 Received: by mail-lj1-f196.google.com with SMTP id k15-v6so19945388ljc.8 for ; Wed, 30 Jan 2019 00:40:11 -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=jMlqcT5n6Y0TNOscyxBffMBgJiOogLraPkkjcc/Obvzpfv4i2HhfR4Pqc7bLuuSiP5 NToiXduqayC4DXZfF+fYe/WmerYr9xXihfGN19wwjoL2r2FikRQFvg7Xsfg8QGjKF0CU 1MMfNuY373hB1ItDams0+l+jDVcPEVJFF8KLOnayXn8R1sjQj8amW3X/204gr3fvvTqD VXfhTGYammTk+1AJCayggr2Kw59+PxqBiz0306jemf7lfSHTVAj4OkOxZPiqb+6SKIh0 2Y6vcmNJ6S/mchL8HioMH1S2KrpXTE1Wa3SjnM4sy46l3sac/Ff+rt8P525vrLhCpDth TXug== X-Gm-Message-State: AJcUukcBJECnfEx1iqOiDkWgcv5tNwuogfpyeqMiwsbGiep2up0AciVI /0y7EseXnh/qBaH/uJoXfpGA1w== X-Google-Smtp-Source: ALg8bN4N+z1oUOLWxj3BtwtxZeQyWP5iPwSp51f13wh7g+Yr3bzLODwzkmouBkcGq76+wFKvU+ZufQ== 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 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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) {