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: 10827355 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 CC23613B5 for ; Sat, 23 Feb 2019 08:50:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B570830D14 for ; Sat, 23 Feb 2019 08:50:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A925630D17; Sat, 23 Feb 2019 08:50:38 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6056230D14 for ; Sat, 23 Feb 2019 08:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Zo588sCcXeEt1nGSzxbTj/tZ2iRNZ0+fVrSD3L5gpv4=; b=lwO 9NVxoalB9wbMfJatjkJw8w7XWTWUAhBujWjIcuUN6hjpjXaSxtg3P8w89d+txX71W1Z2knFPKbkmO 5iIEE4n+xs3v3dIgGjHCNRZKrcPoZCu/SMkdTeslq5c8ebCFE78/M7kWqiwMiniZoXe0x5YAJZzOX YB+Fi+kckrbmZv14ZGiv6fS+UtXjd0hFBY6j84p0qoOQhAb7FWzAxJoJcgp/e5XrTzJgCMqR4dcVz a31dK/8ASViAdrfGLAvg2nBbn3a9B1Kt0kyCkaut1Ij44bE7EFHJsJdm4P83MpwVdvlAupvAZSMm0 z3PoH9QP15YyfR5U6KYil/YSw8RATSQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxT0w-0001Qn-Ig; Sat, 23 Feb 2019 08:50:30 +0000 Received: from 212-186-180-163.static.upcbusiness.at ([212.186.180.163] helo=cgate.sperl.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxT0s-0001PS-6i; Sat, 23 Feb 2019 08:50:28 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190223_005026_420746_BFE39C4F X-CRM114-Status: UNSURE ( 5.43 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martin Sperl MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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