Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4762677imu; Tue, 29 Jan 2019 07:08:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN5yEfWg1/PkHkwMl8hM9Nnxc3TbtzNBy2i7DAqfXEZf+I7vcA38WDs7u8/vsHB5lsVuZLPt X-Received: by 2002:a17:902:8f97:: with SMTP id z23mr26634893plo.283.1548774504665; Tue, 29 Jan 2019 07:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548774504; cv=none; d=google.com; s=arc-20160816; b=TSclUqgCsxwp+bnUQ4Dzv0GpwKqcgZt+Oywyty1/r+0d6f/Ojx/eVFL7iZo8Iplyyt hIWVC1LSDWNJawJ7g6/4kYxxHuZuSn+RX3ceucNBGDYKp/Vz4JI2HfyhGCcxo3dKdZdg JLeEHZaUG4uCPzWIPTjhHkF7rUZKb6aUJuWtT9MpJdtvDAiXQHaoZXAErlAMYWpYmRyU GySDHyjas6PFLSI3oDJDg3kXdx6YDW9Sx4o7q1/ngqQiGRt0ae3KUleVwwC5ldxeD2mv o3FWgQXPB0qGrhlAUwg2rgHlS/nDom4mEm+2RnzLZYBvAmtYS1YE6INo0JYT4mx41sWf VN6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=+lhfCA8eERRwgNX41s/AnJ9AyEoBqNNa+uigT7Q3CBQ=; b=xPvBUc9dgKVWrtspwEfVuecwHlB4s73tBlY7AHR2SPr5+EjHmB2PanhoVQOvLheutt K4bvKvIc/7jkrY5KG4qRfPjGWZr5bPXo/HWuEgsv1GDYm0T0NZ79g0U9RnhkX1ou9qUD pzv5WmWthBKXEL245Q9N7bpAbu5IMgdTphyve9O9g2spm2dxotgCqwSs08WMJxqwKekb eSKiQ18z1nrh1hqUE2ULOkO/ZUuY85/9r+P1fddIaTzuyAIcQ0on/N8HhVuX2CV01p5a 0AJRZGf8jbfBpmbc7Hi9OzSDK97BKzGyXY0VckYeZRmih84S//GzeUwdzMVuf54uaaet NcxQ== 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 v19si37007770pfa.80.2019.01.29.07.08.08; Tue, 29 Jan 2019 07:08:24 -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; 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 S1729297AbfA2PFy (ORCPT + 99 others); Tue, 29 Jan 2019 10:05:54 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:46721 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728177AbfA2PFx (ORCPT ); Tue, 29 Jan 2019 10:05:53 -0500 X-Originating-IP: 109.213.138.65 Received: from localhost (alyon-652-1-35-65.w109-213.abo.wanadoo.fr [109.213.138.65]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 866486001A; Tue, 29 Jan 2019 15:05:50 +0000 (UTC) Date: Tue, 29 Jan 2019 16:05:49 +0100 From: Alexandre Belloni To: Jonas Bonn Cc: Nicolas.Ferre@microchip.com, linux-kernel@vger.kernel.org, broonie@kernel.org, Ludovic.Desroches@microchip.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tudor.Ambarus@microchip.com Subject: Re: [PATCH v4 2/2] spi-atmel: support inter-word delay Message-ID: <20190129150549.GA19959@piout.net> References: <20190129083844.20572-1-jonas@norrbonn.se> <20190129083844.20572-3-jonas@norrbonn.se> <995b3885-254b-7932-8d05-77271a2c070d@microchip.com> <7a6efd1a-5920-60e5-bc68-dfbe6866e522@norrbonn.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7a6efd1a-5920-60e5-bc68-dfbe6866e522@norrbonn.se> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 29/01/2019 15:56:31+0100, Jonas Bonn wrote: > On 29/01/2019 15:27, Nicolas.Ferre@microchip.com wrote: > > On 29/01/2019 at 09:38, Jonas Bonn wrote: > > > > > > + /* DLYBCT adds delays between words. This is useful for slow devices > > > + * that need a bit of time to setup the next transfer. > > > + */ > > > + if (spi->word_delay_us) { > > > > Well... > > > > > + csr |= SPI_BF(DLYBCT, > > > + clamp_t(u8, > > > + (as->spi_clk/1000000*spi->word_delay_us)>>5, > > > + 1, 255)); > > > > ... why not simplifying to: > > + 0, 255)); > > and remove the test altogether, after all? > > Hmm... that seemed too easy! This started out as something else and looking > at it now I think even the clamp_t() is unnecessary. The value is already > 0-255 and the way SPI_BF works any overflow is already truncated... I'll > rework this and resubmit once I get some feedback on the word_delay_us bits. > While at it, note that you need to add spaces around the operators. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com