Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp370394imu; Fri, 25 Jan 2019 03:54:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN51HZG3oKPBEWjXRcuZv7JIL+I8b8XJ/67teOjbKUcNp7RmRz4t3gMteCNJCdF8hsZD4Meu X-Received: by 2002:a17:902:f20b:: with SMTP id gn11mr10251614plb.274.1548417259625; Fri, 25 Jan 2019 03:54:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548417259; cv=none; d=google.com; s=arc-20160816; b=fCsEVrwGHVkNY9P2tI3kKe3G/Zyfvxy3Yf9jAVAAV8IIVPj+l0niy5SvvUJ9aMqE38 e2awFJixurLA/AqOrS06ZXpklrK/QXY8QYKbEQZTXXbYLFZvi8YM8YLJMudgC2U8X0s2 0nypK8WTe8dQWdd/k5xIH1BtwdWUEEFPppCZwsX4gf8WVOTTsEcbpneDwjpB+Z1/8nBQ 2rGrd4BCrp0D2qFBKSzrS2ZgfwowznVngYsrFEs/x+WCVkEG1dZZud6kObHDn4MzOvRQ oYIxiuO8c1cxw68wCVY50ZSZhxnlR2LKvI5cClquJIZ29BHRV2LQAhnhqNrMVseK8l9/ bi9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=k/2XQCv/HLZQJZ1Uo2lI9ZNEWlkaDjnYl83uo8TfY5k=; b=bkVUrhyENsXPVBuYO3DY6ABAoo2OG6Azi/ML1F9Tws2t7lRRmI/yn3lnxDXBccHZ44 2eca3JypNjZA0BMc4gFeTZqi6aBobkz0FVccYQ4vL6lbUy1hnO49fxzUdqpvXcM+wzPd nDPkD+jDbWiidHt+FdQ/m8uILV9hYGPg4hnp+fGOozluYJL5dzSqDERZySuBcJLpQGCG n9Tnb5nDtG6d2DkGWSBCVSczk2L29QZene2ZAl0H3q2np52uJe+RW+45l3Yop0tpkBIc mmfdTPk/BZ3XzULWpYKmwGKN4xvD2UG8XOgQTB9jd8cjeQmgcxpUfCM/Mu3Wj6E60pPG aWqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L+yrXIXA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s73si854521pfs.54.2019.01.25.03.54.04; Fri, 25 Jan 2019 03:54:19 -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=@linaro.org header.s=google header.b=L+yrXIXA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726804AbfAYLx1 (ORCPT + 99 others); Fri, 25 Jan 2019 06:53:27 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:41366 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbfAYLx1 (ORCPT ); Fri, 25 Jan 2019 06:53:27 -0500 Received: by mail-lj1-f196.google.com with SMTP id k15-v6so8116940ljc.8 for ; Fri, 25 Jan 2019 03:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=k/2XQCv/HLZQJZ1Uo2lI9ZNEWlkaDjnYl83uo8TfY5k=; b=L+yrXIXAyjfoA4ZjuE4bmEXn5YVefzgjnR4MnDSDI6kwYNhPXZNHt7trNW6qM3f/ZG Og49oia1DfgXfpsixcRTH1gTFMxCoKWqVzLLhKQWX1zF57kDca4vLXP6ERR+b7Fhh5Tq 3BpBXahzBzdKsWeRK3pMMdBQBb/wmvTEqoEE4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=k/2XQCv/HLZQJZ1Uo2lI9ZNEWlkaDjnYl83uo8TfY5k=; b=B0EBRXNEB5D1+6W/3uefnpHHIUxrT4FuUUqEkoFUiBu8C4rURxpFD5vCsnwio64E5L igLtgesa6FNsIcjJpSTHYf6GVatG4EIY/lIP7uuU8VksHm+xlgoKs8Fa2XccqLZLk/hM 80rx/oyX6xzRaZs8Fz4SwilgXVCQU9No698GkkoCa8g1zu6kxdWAMyfHu4LJjV25zMNz 283Zo63ppiVIyjt0IcVURIk7QxLEpzJUFIzRp8fxtJVGXCiaM3kRUGHpUQq4SDzw5QV3 6nzEMEQnBAS07tEfqsHZfIIs/R+tix3F3+FkWUggspNqH47p1Lj97S7H9Pjjmd9RXnap DYlQ== X-Gm-Message-State: AJcUukf+iv6ivMFNUx4nF/9xN+gPRFp2/7YFOzuYM2SXcPOpi2anpQHV 5lE1kllcYg8SqvZN0KQCcjDjLpEvdx2LjWi28YHmhEBYLKsL6g== X-Received: by 2002:a2e:9849:: with SMTP id e9-v6mr8745729ljj.9.1548417204982; Fri, 25 Jan 2019 03:53:24 -0800 (PST) MIME-Version: 1.0 References: <20190125114429.20066-1-jonas@norrbonn.se> <20190125114429.20066-2-jonas@norrbonn.se> In-Reply-To: <20190125114429.20066-2-jonas@norrbonn.se> From: Baolin Wang Date: Fri, 25 Jan 2019 19:53:13 +0800 Message-ID: Subject: Re: [PATCH 1/2] spi: support inter-word delay requirement for devices To: Jonas Bonn Cc: LKML , linux-spi , Mark Brown , Rob Herring , Mark Rutland , DTML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, 25 Jan 2019 at 19:44, Jonas Bonn wrote: > > Some devices are slow and cannot keep up with the SPI bus and therefore > require a short delay between words of the SPI transfer. > > The example of this that I'm looking at is a SAMA5D2 with a minimum SPI > clock of 400kHz talking to an AVR-based SPI slave. The AVR cannot put > bytes on the bus fast enough to keep up with the SoC's SPI controller > even at the lowest bus speed. > > This patch introduces the ability to specify a required inter-word > delay for SPI devices. It is up to the controller driver to configure > itself accordingly in order to introduce the requested delay. Can we configure it at runtime by the device rather than at DT time by the controller? If yes, we already have a patch for this, please check: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eeaceb8b7d1fb64b6030249ca0dd1d902ef3069e > > Signed-off-by: Jonas Bonn > CC: Mark Brown > CC: Rob Herring > CC: Mark Rutland > CC: linux-spi@vger.kernel.org > CC: devicetree@vger.kernel.org > --- > Documentation/devicetree/bindings/spi/spi-bus.txt | 1 + > drivers/spi/spi.c | 4 ++++ > include/linux/spi/spi.h | 1 + > 3 files changed, 6 insertions(+) > > diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt > index 1f6e86f787ef..a5f20060676d 100644 > --- a/Documentation/devicetree/bindings/spi/spi-bus.txt > +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt > @@ -77,6 +77,7 @@ All slave nodes can contain the following optional properties: > Defaults to 1 if not present. > - spi-rx-delay-us - Microsecond delay after a read transfer. > - spi-tx-delay-us - Microsecond delay after a write transfer. > +- spi-word-delay-us - Microsecond delay between individual words of a transfer > > Some SPI controllers and devices support Dual and Quad SPI transfer mode. > It allows data in the SPI system to be transferred using 2 wires (DUAL) or 4 > diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c > index 9a7def7c3237..cd4d4065eca2 100644 > --- a/drivers/spi/spi.c > +++ b/drivers/spi/spi.c > @@ -1692,6 +1692,10 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, > } > spi->max_speed_hz = value; > > + if (!of_property_read_u32(nc, "spi-word-delay-us", &value)) { > + spi->word_delay = value; > + } > + > return 0; > } > > diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h > index 314d922ca607..e5200dd9d750 100644 > --- a/include/linux/spi/spi.h > +++ b/include/linux/spi/spi.h > @@ -164,6 +164,7 @@ struct spi_device { > char modalias[SPI_NAME_SIZE]; > const char *driver_override; > int cs_gpio; /* chip select gpio */ > + uint16_t word_delay; /* inter-word delay (us) */ > > /* the statistics */ > struct spi_statistics statistics; > -- > 2.19.1 > -- Baolin Wang Best Regards