Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1886012imm; Thu, 11 Oct 2018 01:11:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV60TOhoZM5Fjs76BRHY7eXyxBcbD6v7GJ1F8XtmNjCyX+8fz9DTJqpSniHdERoeiYrmxb39A X-Received: by 2002:a62:3047:: with SMTP id w68-v6mr561860pfw.19.1539245499647; Thu, 11 Oct 2018 01:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539245499; cv=none; d=google.com; s=arc-20160816; b=iU2SbvNPWRFmw18TgItd5yU65se8TWzPdYXBP1jhPJ9o/04Fq2acjsxwXih5EK21Ir EZq/TRveH7Jy8bL7vBf2cgp2i9hwe53d65t+uIwEFkNVt4ArdbZCd4RjAy8NRsbTdV8W FYZuvR3bFyAZT0dcngLQs54+VCjgJF0gLz+heOIfJEYWbcK+VIclfaFmaT31ibvB8Foq AcjixBUAdCnQGkh/PhqKajRDef0kLzRxO4nyxxlDCRiqHQwT4d1INKLHWIzRvr9TZdEg llH1EzkdvOHlL6VpNJ8PxD2T4RMGQeEZBGNmYTdMQxPMF/FuQ1w1qHPLMRLLDoEW0U4W MsPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=Rgzss9oBxEG4zEiaczQLLQAfujpqxiCO5hAxTZNpfAA=; b=T/zndRJyHlFeaJV47IpW23pKedPWfDcXXdZx68fQGFR+KCQ74UDnBD77ybbdU6eBEP LD9t85kJVlx2O3HbKqgRk6DP7I43sQspDJkLkTb07H+xnYWmBcWJQuJ2oijzt3Av2ztm FAEdFySV4/rvJfzlj6LyviZ1XCt802wITh4tu24HNMoBc+ZJntqGsjpfeKlgI5M/5Y7j jrJViiDjVX/9Sw0+TXNMh/Uve/dZt+nIKn9CfGTaBUgWQj9dR9rNiiq1ulV17nZ5AhRm yUX+MlhQ6ZrA819M2BiRNL/kcwm+Vh/unJgNY8ntpt134pTTPtZjcOqNX6TrjLjmPff4 1eeg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v129-v6si26891854pgv.504.2018.10.11.01.11.24; Thu, 11 Oct 2018 01:11:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727714AbeJKOyx convert rfc822-to-8bit (ORCPT + 99 others); Thu, 11 Oct 2018 10:54:53 -0400 Received: from mail-vs1-f67.google.com ([209.85.217.67]:43722 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbeJKOyx (ORCPT ); Thu, 11 Oct 2018 10:54:53 -0400 Received: by mail-vs1-f67.google.com with SMTP id w85so7578748vsa.10; Thu, 11 Oct 2018 00:28:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=QAAroYkfcBIcMCAVUykvNxgkUAGX2wNg9Gn3/7/+U6k=; b=uVwGdxSdF/HvxYqqY3UuxB+T0d/i1Yi9SskS/ZghAjZi5U+izw1MUk3EvMN3RMb8WC ZseQZiU/Nn+hs/NpeXg15pFUyoyrk7pmduR+2zgWEL3zfHJWdsNWQhGV2rnW5D8NfppD RekPddYu4bRPkVqUDfK92n7R/ZaJlGNoD5Gu/a6Ejy4wMnsSj/quzP8dSgFWJNd+Swyo H26Aa+Ykw1zcR8WFmjfvT8qqDafnZgwTT7h/36bnnd1tln4VTXEmxzEBMwjwCm03m/3t Eun3sCvwKT6NYajW8Twhwt+yOZnRBgo76cU0LZNzKx/xracsZbb4uP0T6/0j3LHq1qvB bldw== X-Gm-Message-State: ABuFfojNOoLbmSq/hNA18/7gt/d8jIn9+7qTk2fCVHDobY5AVlyjLtZv rLOQmHBnkeY0fKpdCpbmUP0YekZM6kwJw2CKcNo= X-Received: by 2002:ab0:6093:: with SMTP id i19mr172725ual.75.1539242932301; Thu, 11 Oct 2018 00:28:52 -0700 (PDT) MIME-Version: 1.0 References: <20181010170936.316862-1-lkundrak@v3.sk> <20181010170936.316862-11-lkundrak@v3.sk> In-Reply-To: <20181010170936.316862-11-lkundrak@v3.sk> From: Geert Uytterhoeven Date: Thu, 11 Oct 2018 09:28:39 +0200 Message-ID: Subject: Re: [PATCH 10/11] spi: pxa2xx: Add ready signal To: Lubomir Rintel Cc: Mark Brown , Geert Uytterhoeven , quozl@laptop.org, Rob Herring , Mark Rutland , Eric Miao , Haojian Zhuang , Daniel Mack , Robert Jarzmik , linux-spi , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , Linux ARM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lubomir, On Wed, Oct 10, 2018 at 7:10 PM Lubomir Rintel wrote: > 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 Thanks for your patch! I'm repeating my comments on the RFC below: > --- 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); While gpiod_set_value() handles the case of no GPIO fine, I think it's better to explicitly check for that, so you can avoid spinning for 1 µs if the GPIO is not present. > } > > /* > @@ -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); The cast to int is not needed. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds