From patchwork Wed Oct 10 17:09:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10635049 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 8FAA513AD for ; Wed, 10 Oct 2018 17:54:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B9192A675 for ; Wed, 10 Oct 2018 17:54:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F4CF2A696; Wed, 10 Oct 2018 17:54:37 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 93BB02A675 for ; Wed, 10 Oct 2018 17:54:36 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=ludji0U7+z5flSW3R3HlDUkUfbEiHRbKBUm+G/mAuEw=; b=A1PlqWX9xhuVU+ 18kH052qEBw4VnvNAK3oQJkGLOPND9SYiEU3hO7YAxz2CL9MQntKPGmSFpEWfR3GVlf5X7g+/tsl1 Euvn3qdg1ETCnNhFbfeUK54SAlLB+KxY5Uw9xOWiNcsvSqms/BAvFvxChUvhgwWBOkJ8gcJKtp7oa 6EfOdM4WKiVnGAJ6l9Tp+S7KQi42hpmm7yMnzLWigxhtZDOmq+1KGxEkZTLJTY5e1aj3W+1Ygo+lh Wy0Hg3gnEpY10qIEGDUdgDjr0yKHd44Sf0Sc+tJTgw05XnYmKon7ojM2DT4+xxI/C+MRL3DVKku+a rENECCDXfUhW28todDTQ==; 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 1gAIgl-0000fD-Kb; Wed, 10 Oct 2018 17:54:27 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAIXi-0003re-2C for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 17:45:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BaZP6uKaOKUcEeWk8sD2zpyrcdnIII++yBfGl5acty8=; b=rBr4ZBDsvg1WG7j4kmHjttC+dj 6mhzC71KQipVkGaxbZT83Tgn/Doupsy/Bd9IK8bs6nN4VmAmrCPDEbE7rViRhu5g67EfvDrGsNcOJ 8rANw8E5ULv7V3cRMDdR8oUG+UjIAmTTMePqmonrzGj/Dvs/HUCDY4Pp7eJwRK/wtsTNeBCobmAgY VdBWm74cwTlYZWbPSYsLEPTUWnZoqWh6dnVUYWJHM1Z+Xr3g2lahpU/XUVp22mo1bIyJ3KoDKfefC xBJ4OM1aG8EpPOf/feXmcOKHBQ0Y3aCBy6tgHu3Wr+PRsVIP3fVmNgwfUNVBXBPiggdh2TvHZ61BS oQNRsThw==; Received: from shell.v3.sk ([90.176.6.54]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI0I-0006L8-Kg for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:10:36 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 05FB6BCFB1; Wed, 10 Oct 2018 19:10:23 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id YLhjDiubGH4A; Wed, 10 Oct 2018 19:10:06 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id DC636BCF8E; Wed, 10 Oct 2018 19:09:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id A03z38LnQTVf; Wed, 10 Oct 2018 19:09:57 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id 374E0BCF83; Wed, 10 Oct 2018 19:09:55 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH 10/11] spi: pxa2xx: Add ready signal Date: Wed, 10 Oct 2018 19:09:35 +0200 Message-Id: <20181010170936.316862-11-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_181034_734267_DC23D94C X-CRM114-Status: GOOD ( 14.60 ) 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 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 Acked-by: Pavel Machek --- drivers/spi/spi-pxa2xx.c | 12 ++++++++++++ drivers/spi/spi-pxa2xx.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 3848842d68fd..a3b4b12c1077 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1079,6 +1079,9 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *master, if (spi_controller_is_slave(master)) { while (drv_data->write(drv_data)) ; + gpiod_set_value(drv_data->gpiod_ready, 1); + udelay(1); + gpiod_set_value(drv_data->gpiod_ready, 0); } /* @@ -1784,6 +1787,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 = (int)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 {