From patchwork Tue Nov 13 18:34:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 10681267 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 15FAD13B5 for ; Tue, 13 Nov 2018 18:35:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C01F2AF64 for ; Tue, 13 Nov 2018 18:35:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 000F62B039; Tue, 13 Nov 2018 18:35:28 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 886F82AF64 for ; Tue, 13 Nov 2018 18:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730782AbeKNEel (ORCPT ); Tue, 13 Nov 2018 23:34:41 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:45272 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730909AbeKNEej (ORCPT ); Tue, 13 Nov 2018 23:34:39 -0500 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=9QuBJTAPsOAgolTfxE37V9Lzx9CK9SU+PkIy38j1Nzs=; b=utvybBlyuzWH 3wW1A46Z1hsiPjBp5fe9Sh+xTzwaq0ZETi9tEDRhjawkVAuRb7wzOQx3HCJrgh5YmvojEexfimxLw kahjlQuGvoK5iQC1+usv60auJYfMn5aJNOGebfKikVEIUdpR6PWlfSkEjIfL438aQpSazyTN71AKQ v67Ug=; Received: from [64.114.255.97] (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 1gMdWc-0002Pg-C8; Tue, 13 Nov 2018 18:34:58 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 099FD440079; Tue, 13 Nov 2018 18:34:54 +0000 (GMT) From: Mark Brown To: Lubomir Rintel Cc: Pavel Machek , Mark Brown , Mark Brown , Geert Uytterhoeven , James Cameron , Rob Herring , Mark Rutland , Eric Miao , Haojian Zhuang , Daniel Mack , Robert Jarzmik , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Subject: Applied "spi: pxa2xx: Add ready signal" to the spi tree In-Reply-To: <20181113102228.820214-6-lkundrak@v3.sk> Message-Id: <20181113183454.099FD440079@finisterre.ee.mobilebroadband> Date: Tue, 13 Nov 2018 18:34:53 +0000 (GMT) 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 The patch spi: pxa2xx: Add ready signal 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 77d33897c68d56797a3201e06bdf10e2094a96d6 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 13 Nov 2018 11:22:27 +0100 Subject: [PATCH] spi: pxa2xx: Add ready signal Strobe a GPIO line when the slave TX FIFO is filled. This is how the Embedded Controller on an OLPC XO-1.75 machine, that happens to be a SPI master, learns that it can initiate a transaction. Signed-off-by: Lubomir Rintel Tested-by: Pavel Machek Reviewed-by: Geert Uytterhoeven Signed-off-by: Mark Brown --- drivers/spi/spi-pxa2xx.c | 16 +++++++++++++++- drivers/spi/spi-pxa2xx.h | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index a057c3be7e3b..69b221e34b2d 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1081,6 +1081,11 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *master, if (spi_controller_is_slave(master)) { while (drv_data->write(drv_data)) ; + if (drv_data->gpiod_ready) { + gpiod_set_value(drv_data->gpiod_ready, 1); + udelay(1); + gpiod_set_value(drv_data->gpiod_ready, 0); + } } /* @@ -1778,7 +1783,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) if (PTR_ERR(gpiod) == -ENOENT) continue; - status = (int)PTR_ERR(gpiod); + status = PTR_ERR(gpiod); goto out_error_clock_enabled; } else { drv_data->cs_gpiods[i] = gpiod; @@ -1786,6 +1791,15 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) } } + if (platform_info->is_slave) { + drv_data->gpiod_ready = devm_gpiod_get_optional(dev, + "ready", GPIOD_OUT_LOW); + if (IS_ERR(drv_data->gpiod_ready)) { + status = PTR_ERR(drv_data->gpiod_ready); + goto out_error_clock_enabled; + } + } + pm_runtime_set_autosuspend_delay(&pdev->dev, 50); pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_set_active(&pdev->dev); diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 513c53aaeab2..4e324da66ef7 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -64,6 +64,9 @@ struct driver_data { /* GPIOs for chip selects */ struct gpio_desc **cs_gpiods; + + /* Optional slave FIFO ready signal */ + struct gpio_desc *gpiod_ready; }; struct chip_data {