From patchwork Sat Feb 23 08:49:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sperl X-Patchwork-Id: 10827345 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 23E8B1399 for ; Sat, 23 Feb 2019 08:50:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BF592F9F1 for ; Sat, 23 Feb 2019 08:50:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE08030CCE; Sat, 23 Feb 2019 08:50:09 +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,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 2F2E22F9F1 for ; Sat, 23 Feb 2019 08:50:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726232AbfBWIuI (ORCPT ); Sat, 23 Feb 2019 03:50:08 -0500 Received: from 212-186-180-163.static.upcbusiness.at ([212.186.180.163]:47824 "EHLO cgate.sperl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726043AbfBWIuI (ORCPT ); Sat, 23 Feb 2019 03:50:08 -0500 Received: from hc1.intern.sperl.org (account martin@sperl.org [10.10.10.59] verified) by sperl.org (CommuniGate Pro SMTP 6.2.1 _community_) with ESMTPSA id 7757388; Sat, 23 Feb 2019 08:50:05 +0000 From: kernel@martin.sperl.org To: Mark Brown , Eric Anholt , Stefan Wahren , linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Cc: Martin Sperl Subject: [PATCH 0/5] allow to define cs deassert times in us, ns and SCK-len Date: Sat, 23 Feb 2019 08:49:47 +0000 Message-Id: <20190223084952.14758-1-kernel@martin.sperl.org> X-Mailer: git-send-email 2.11.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 From: Martin Sperl Using spi_transfer.cs_change right now means that there is a hard-coded 10 us delay between deassert and re-assert of cs. For some devices this is way too long and either wastes resources unecessarily or the driver works arround this currently with multiple spi messages. So this patch set modifies the spie core and some drivers so that in spi_transfer we now can now define the minimum delay in units of: microseconds, nanoseconds or spi clock length. But note that on lower specs machines those ns delays are not realistic. Lower limits on the actual delay are put by the gpio framework latency for setting gpio level. On a Raspberry Pi 3 this overhead has been observed to be in the order 1.2us. As an idea: the xfer->cs_change_delay_unit could become more generic by renaming it to delay_unit and then also us it as a modifier when using xfer->delay_usecs. Martin Sperl (5): spi: core: allow defining time that cs is deasserted spi: core: allow reporting the effectivly used speed_hz for a transfer spi: core: allow defining time that cs is deasserted as a multiple of SCK spi: bcm2835: support effective_speed_hz spi: bcm2835aux: support effective_speed_hz drivers/spi/spi-bcm2835.c | 5 ++-- drivers/spi/spi-bcm2835aux.c | 5 ++-- drivers/spi/spi.c | 68 +++++++++++++++++++++++++++++++++++++------- include/linux/spi/spi.h | 13 +++++++++ 4 files changed, 75 insertions(+), 16 deletions(-) --- 2.11.0