Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2617044yba; Mon, 8 Apr 2019 00:32:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyc2O2wSlWkX7ju4UsdoSOtc7lLe9YI+is0O/1fjszLBtgJPGV1Lx/SFA/njWmful9WBG2f X-Received: by 2002:a63:e653:: with SMTP id p19mr26544783pgj.284.1554708771174; Mon, 08 Apr 2019 00:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554708771; cv=none; d=google.com; s=arc-20160816; b=YLd6Z4Nh25TDFJMTrJnx0l08cCqq00JmVLktIwQw1EqKk59hyKafkHf/qteyu8EJ17 5SKUR7krFHE/KP49cPB3yoaXRxCjWo3PtfDRCr7lg4jXeTM8eZbqTpOCOLUDR9XDngFS t4K1SjjsSd+Kwbr/h49RgS/VVtzP92MudTWCXSdTGxM/AWnnUCkHDpNSW1Vv+MqCgIRb O2MlshUG7EGjLK63OcnzsoSY9BSHyou2ByMU3ue0LNAvpX8O/xrmJQCGbtFzo1/+7uCC vSvIAGI1YErKE/3ZlqWM0YcEtOshzhnxfGAGAc8C2H8kD4E1gXxPdFU9V1CPgce8xHK6 BG2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=5XG/PEmpUe1Wg5kuPz4A4uwQ9+8HTR7RfZskFZI5DjI=; b=JFZ6bwvwPPh2qz6lwBMAxeGnWeUVi8LkbsVQvqdso2F/O/+m0ivOKa7Uq5/peO2OgW 5GRFmeG3cR6dL0otW4smBlX3b/sqzC6bLQowU+0HrtgciIFiZva6G8KUTmVw/awb5T/1 Ihrpf056WVSWIyHxYDSc/Q5/ymYbPvjczENFibckfmA+3VtXIjwE42epSL2PAdX5CfzU uP/UmZOyW1KtWfmJdZs066VNL82jGwjVFxbfUr/ElhD5FcArXn8lsMFxazRTrnviUJpG P74seNWCgVP8vF26fWSdmE9xrTTLsWBve+AJ0hOmE155xkygMP3ITlwqBQhPKSVU/3fh 0G+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Ykjp+BBI; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j35si26564901plb.61.2019.04.08.00.32.36; Mon, 08 Apr 2019 00:32:51 -0700 (PDT) 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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Ykjp+BBI; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726731AbfDHHb4 (ORCPT + 99 others); Mon, 8 Apr 2019 03:31:56 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:43494 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726373AbfDHHbz (ORCPT ); Mon, 8 Apr 2019 03:31:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=5XG/PEmpUe1Wg5kuPz4A4uwQ9+8HTR7RfZskFZI5DjI=; b=Ykjp+BBIEIZh Kmu4C/rs4MQlLzDRjJh/3TWIc43fG5YZ8EFVm8yTv03zlJClpXsYZwB9CiOPUo1gvl3mbhhOkHsFa IAjznXlTAXFkXDB075dFIahJ2KGRpbFuvZQOC6ek8+5kumNxTBrbdV1Y3IJGPTY/JydLoLWFF1Lh9 EckWo=; Received: from [8.46.76.46] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hDOkl-0003wb-Pz; Mon, 08 Apr 2019 07:31:41 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 6E37B441D3C; Mon, 8 Apr 2019 14:31:29 +0700 (+07) From: Mark Brown To: Sowjanya Komatineni Cc: Mark Brown , thierry.reding@gmail.com, jonathanh@nvidia.com, talho@nvidia.com, skomatineni@nvidia.com, broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, kyarlagadda@nvidia.com, ldewangan@nvidia.com, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-spi@vger.kernel.org Subject: Applied "spi: add a method for configuring CS timing" to the spi tree In-Reply-To: <1554423259-26056-17-git-send-email-skomatineni@nvidia.com> X-Patchwork-Hint: ignore Message-Id: <20190408073129.6E37B441D3C@finisterre.ee.mobilebroadband> Date: Mon, 8 Apr 2019 14:31:29 +0700 (+07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch spi: add a method for configuring CS timing has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From f1ca9992ced71029735784de138f53446363087f Mon Sep 17 00:00:00 2001 From: Sowjanya Komatineni Date: Thu, 4 Apr 2019 17:14:16 -0700 Subject: [PATCH] spi: add a method for configuring CS timing This patch creates set_cs_timing SPI master optional method for SPI masters to implement configuring CS timing if applicable. This patch also creates spi_cs_timing accessory for SPI clients to use for requesting SPI master controllers to configure device requested CS setup time, hold time and inactive delay. Signed-off-by: Sowjanya Komatineni Signed-off-by: Mark Brown --- drivers/spi/spi.c | 15 +++++++++++++++ include/linux/spi/spi.h | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index fd1372fe0505..bf4027b54a19 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2995,6 +2995,21 @@ int spi_setup(struct spi_device *spi) } EXPORT_SYMBOL_GPL(spi_setup); +/** + * spi_set_cs_timing - configure CS setup, hold, and inactive delays + * @spi: the device that requires specific CS timing configuration + * @setup: CS setup time in terms of clock count + * @hold: CS hold time in terms of clock count + * @inactive_dly: CS inactive delay between transfers in terms of clock count + */ +void spi_set_cs_timing(struct spi_device *spi, u8 setup, u8 hold, + u8 inactive_dly) +{ + if (spi->controller->set_cs_timing) + spi->controller->set_cs_timing(spi, setup, hold, inactive_dly); +} +EXPORT_SYMBOL_GPL(spi_set_cs_timing); + static int __spi_validate(struct spi_device *spi, struct spi_message *message) { struct spi_controller *ctlr = spi->controller; diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index a0975cf76cf6..589f9dc9ac2b 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -330,6 +330,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) * must fail if an unrecognized or unsupported mode is requested. * It's always safe to call this unless transfers are pending on * the device whose settings are being modified. + * @set_cs_timing: optional hook for SPI devices to request SPI master + * controller for configuring specific CS setup time, hold time and inactive + * delay interms of clock counts * @transfer: adds a message to the controller's transfer queue. * @cleanup: frees controller-specific state * @can_dma: determine whether this controller supports DMA @@ -363,6 +366,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) * @unprepare_transfer_hardware: there are currently no more messages on the * queue so the subsystem notifies the driver that it may relax the * hardware by issuing this call + * * @set_cs: set the logic level of the chip select line. May be called * from interrupt context. * @prepare_message: set up the controller to transfer a single message, @@ -488,6 +492,17 @@ struct spi_controller { */ int (*setup)(struct spi_device *spi); + /* + * set_cs_timing() method is for SPI controllers that supports + * configuring CS timing. + * + * This hook allows SPI client drivers to request SPI controllers + * to configure specific CS timing through spi_set_cs_timing() after + * spi_setup(). + */ + void (*set_cs_timing)(struct spi_device *spi, u8 setup_clk_cycles, + u8 hold_clk_cycles, u8 inactive_clk_cycles); + /* bidirectional bulk transfers * * + The transfer() method may not sleep; its main role is -- 2.20.1