From patchwork Sat Jan 26 16:32:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Bonn X-Patchwork-Id: 10782511 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 573BE1399 for ; Sat, 26 Jan 2019 16:32:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 432602E387 for ; Sat, 26 Jan 2019 16:32:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 374FD2E38A; Sat, 26 Jan 2019 16:32:31 +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 9AB292E387 for ; Sat, 26 Jan 2019 16:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726295AbfAZQc3 (ORCPT ); Sat, 26 Jan 2019 11:32:29 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:37184 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726084AbfAZQc2 (ORCPT ); Sat, 26 Jan 2019 11:32:28 -0500 Received: by mail-lf1-f66.google.com with SMTP id y11so9030573lfj.4 for ; Sat, 26 Jan 2019 08:32:26 -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=PsBSv2w17w6lFrPapCk73CTS8LZT3j2+sF5Y7dWKzLc=; b=VN86UBu8NBXSChaiDHPIstNyAefKEC644yIFDOL81BghZ99qWqiGI4VWBaPrtVo+1S K2hAmpRAt7//vves1VSuPUaUdz4yAnsjEQPYdukgaHSVgxxgJ6rCJdgaB78Q7/nGNum7 2nWXt14pDtC3/z57oLpwMD8LoHhcJxMu1ZiAhQeASDKqJzmeTogsRbkMHpxh3eY17+fd eqW9vCKXIxQOqQGE+hwH+fWGjy0+g8d+AUVUOa7mS8ShT3t/OjFr075jfkO3LR4BlCP6 j58ehEqZ3rOK/s1teXBzJWt55x4rd7OWdBsfxpgVe/ZFQ2IIcOGtbKlYibtpppGcfRog 6+jQ== 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=PsBSv2w17w6lFrPapCk73CTS8LZT3j2+sF5Y7dWKzLc=; b=ChfKy0BP0YAfsflmP0bEaFpE8pYnHX+EWslmzQIuguNOlZYpM6rrGNcd6S7NmX28Hp g08OKHUuIRP8TcFf6ZsMRRQz35dFnDf5yWDOkwQxZncvBA4ycu8a539pfmTyE/GPpSwB 8K9p20QjfFgMjKC87P7AjT2MaSTeui2vvrlS8fbT8xzxzj0Ji2IiDBDO/uBzpU9l468U IPrvCJem87fRUSxmWDjvEtpRWCMB4TTo5yMSbuFVqtM37nm3sptyv2h8jt4jU79BidhU uiZHY/dUxtYW6XeVKauAUuX4cQzP23q+raq6bCx7aWMl3XbH7X8RN0zP4yBSKPmaR1yo V49g== X-Gm-Message-State: AJcUukckSDcajRUR6qySuB9jt7+F0B2/W/HHQIcghTTu1ezkWqq90v7M 0NXX+c8cvMj30qQl5Dl/HPmyOQ== X-Google-Smtp-Source: ALg8bN7LcYWaZVZJURFcXQFktVTSS0vQsLo6bWUgWp5pDrNVMQnth9Xh5ER9AATWYrc84v+OnUyDwQ== X-Received: by 2002:a19:c954:: with SMTP id z81mr11943281lff.150.1548520345708; Sat, 26 Jan 2019 08:32:25 -0800 (PST) Received: from mimer.lan (h-29-16.A159.priv.bahnhof.se. [79.136.29.16]) by smtp.gmail.com with ESMTPSA id e94sm2170532lfi.23.2019.01.26.08.32.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Jan 2019 08:32:25 -0800 (PST) From: Jonas Bonn To: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Cc: Jonas Bonn , Mark Brown , Rob Herring , Mark Rutland , devicetree@vger.kernel.org Subject: [PATCH v3 1/2] spi: support inter-word delay requirement for devices Date: Sat, 26 Jan 2019 17:32:19 +0100 Message-Id: <20190126163220.26421-2-jonas@norrbonn.se> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190126163220.26421-1-jonas@norrbonn.se> References: <20190126163220.26421-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 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. 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 --- include/linux/spi/spi.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 314d922ca607..8e410de02af4 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -118,6 +118,8 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats, * for driver coldplugging, and in uevents used for hotplugging * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when * not using a GPIO line) + * @word_delay: microsecond delay to be inserted between consecutive words + * of a transfer * * @statistics: statistics for the spi_device * @@ -164,6 +166,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;