Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp365543imu; Fri, 25 Jan 2019 03:48:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN6PLI1Zt6bXhz9hcgZPUEnV1RN2wRJ+MnEHwLS0hg7KVGNsaF3rD4y8yb/zGjpKRedIy/3r X-Received: by 2002:a17:902:8d95:: with SMTP id v21mr10655704plo.162.1548416908426; Fri, 25 Jan 2019 03:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548416908; cv=none; d=google.com; s=arc-20160816; b=yTu1Xc4vug9bx7rIh1GXNKVCzdsxt3Zfx40P6hHLYSNrN32AXgo6erMQq646r1wahZ QCYvqm3NjU7NsbSS9zi8vfQfYtHMSLWO4DMAA9CTglvfK6HDT6kW9+J+HKlpvXSwuvrj Q4F38N83ZvBmcQd4HeRmSzmas1g579Jd15TrmKX9FnrBn0KosTN5VEpbTra/jgxdvbDH yZa/R9DtMFNXwSF8hCF21C3JiRDX/DJ3QqCIVcF24iQtXL+svkzOKiK2WNDueG9lEf/X bkL9zTok8YxbPPBsQyrolbKsYE22bvRdS+iWZ9EWuWDXuAMp8iv4PnRpEQx3Jfqja15c eVdQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=C31nlWpUsUu8j1iiazgCD439xBD7EbLuX36kiR/KNSI=; b=lDHaT74r3P1zEqJ4P/Qta6O4Q6XcTw3k6ehjz5nHaqXDguvnWL/RYKpGfDDtVhA5Mf 87hwGXg/6+9a3FNXvf7jbiaFwf+y/FmqzmaJbrmPW5W9JEpSm1QPuJmSpFqdKOKGJK9q bgdnYkbwHhMjNKttyrhVOh/yH+8hww64UGHt6Ua8ZAncggUPEUkVA/4+wUAdNviF2T+v PsIcpmW6gHhRPXdarKzcW6IzdXeEEHnlie9i413MK5npIPopcW5H9fPK67BFcQfr8HvT a2iGaJXTjYfs6w3qKfPTwRtdT+u0spv8Ifdq7DqB0Scb6aM1X36nWmzvZDvN7TKV35UP +Sxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@norrbonn-se.20150623.gappssmtp.com header.s=20150623 header.b=yKYWZX9o; 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 i6si1787501plt.290.2019.01.25.03.48.13; Fri, 25 Jan 2019 03:48:28 -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=yKYWZX9o; 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 S1727996AbfAYLrU (ORCPT + 99 others); Fri, 25 Jan 2019 06:47:20 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:33514 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbfAYLrT (ORCPT ); Fri, 25 Jan 2019 06:47:19 -0500 Received: by mail-lj1-f196.google.com with SMTP id v1-v6so8156753ljd.0 for ; Fri, 25 Jan 2019 03:47:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=norrbonn-se.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=C31nlWpUsUu8j1iiazgCD439xBD7EbLuX36kiR/KNSI=; b=yKYWZX9oCKoMT2Fi/l3X1JV0wUphRDT2IxMzR7Wai8+fciGvOYKSaHLAVLUOkf9i8k +IOenP2MM0HMxoDWO1eyDwfybr44T5xVoWm9gczZDqyEoIIP1CnhylynJ4XKtnCrUpiB qdl7gQMAJCjBaSpDeZPn6gzZIonSYqworKlmxx7KZmKsCeByGwFFs/mVfWgMuiVjxnb/ UbbfZEX9yPx+2g5paDNDpQE1MtSWi26oMYcZd70vXS6MNBXzNXAB9W+C+DEeXgXdywg7 AEwH2VrWjT++EIY1hVl84fHsJmnAcyPP4+ecljFz0dQ3XMfSWVObLt5Q/4lUV6bnDj0X aMTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=C31nlWpUsUu8j1iiazgCD439xBD7EbLuX36kiR/KNSI=; b=OVB5NDDvW7Dw9gLzFidzokqSFIouwBwx/0BYmtjByvt8gJ9HqmIpM8FW29hASL40Ny 8nQ9dIEv26T3tmQuWcaShheTawxqlQjMpN905bt/9uPIR4NuTnkhbObFls9xxjMKg6xk RPK0ITcLAzJnqp11+KMG/pWCBkbEJOpiGIC1BQBSPmLM/gVjJw6EVK/lJlTl9RHJv8ha QKhdqMPTmkE5rhAfVoLTdtmBRCfAXwK4nUbWV2xDJjohGbr6AyyeSQ/2cYoYeaIpDvVQ cYKCMr98mufFg6qzd7APhSTmSaCNyO02HxzHtDpo1KLNuBYUt4nC+XJPYMaOiayn8Jvy MWnw== X-Gm-Message-State: AJcUukcyJURJwqSZ+YChLmzOHKmqS4N1T+R+Un/Sx9dD59ilMM/ehkqK gRxaVqJ4gVGkdGstCTu9VwEBwg== X-Received: by 2002:a2e:58b:: with SMTP id 133-v6mr8263289ljf.127.1548416837534; Fri, 25 Jan 2019 03:47:17 -0800 (PST) Received: from [192.168.1.169] (h-29-16.A159.priv.bahnhof.se. [79.136.29.16]) by smtp.gmail.com with ESMTPSA id 15-v6sm1611419lje.18.2019.01.25.03.47.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jan 2019 03:47:17 -0800 (PST) Subject: Re: [PATCH 2/2] spi-atmel: support inter-word delay To: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Cc: Nicolas Ferre , Mark Brown , Alexandre Belloni , Ludovic Desroches , linux-arm-kernel@lists.infradead.org References: <20190125114429.20066-1-jonas@norrbonn.se> <20190125114429.20066-3-jonas@norrbonn.se> From: Jonas Bonn Message-ID: <296f8326-a33d-8db1-ca71-c6aba21b1302@norrbonn.se> Date: Fri, 25 Jan 2019 12:47:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190125114429.20066-3-jonas@norrbonn.se> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/01/2019 12:44, Jonas Bonn wrote: > 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 74fddcd3282b..88ff3fef56e9 100644 > --- a/drivers/spi/spi-atmel.c > +++ b/drivers/spi/spi-atmel.c > @@ -1209,13 +1209,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, > + clamp_t(u8, (as->spi_clk/1000000*spi->word_delay)>>5, 1, 255)); Ah... this is stupid. The clamping here _always_ introduces a delay, which is not what we want... will resubmit this. /Jonas > > /* chipselect must have been muxed as GPIO (e.g. in board setup) */ > npcs_pin = (unsigned long)spi->controller_data; >