From patchwork Fri Jul 26 15:24:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 169859 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp198593ilk; Fri, 26 Jul 2019 08:27:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIxi4DJhgNfhZ1d5bYjGVxrGIGCi1EoQ5IwadGxsnQ4zS8mM5l9HXg295Ac3259Rj9ONye X-Received: by 2002:a17:902:8b88:: with SMTP id ay8mr93799586plb.139.1564154856067; Fri, 26 Jul 2019 08:27:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564154856; cv=none; d=google.com; s=arc-20160816; b=ucLzNyzu9itoIRH2+bqhBrILj/4DOeq7W0lfeQAvdZR8Ju5FrrpsggUuVux1vwaOv/ ZsTDKyh1nI6fYwcMc8yr8PVCt7POEhZ0ELVS+lhzI2HgFDRl1R6NSA9jNJUtzopKuKUF tTJcXGrF4QabOijrnFRF3tsNBvq6m1WFJtEhGBfqI94Kgkymig3xYLVTsgYqFLU5vYur GHzqB5KO1hK7s9jmRNthuXk0praHPjrk1xJCHHX04AkEQMXI1ovDZTN5rDGKTXFFvv4q i7C5zfRf0aU678I0NbuNwZ9XZK5NZi7KSUxjCrgkPzkYvRePco3zZbx9DQRfoQkfAxZS QyEw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EdTNiz98V3DkpkJW4ph+XRPTX5x38s49yHxmscK0Na0=; b=NgZHL9E185JM8pyRzAVyQxImRnsNqUtwyvE1Lh+dXvBnCX7n/fNqakhviedzn/twII yAP7cJkRSZtafr+ERGInOLolqjt00jTIWPfOqd3lL11N2zyiuRS+v7Mk5jvPDx2+gry7 3iDHxgKGRlywTaRrF8UzjTo5lC64iPebgCp9DgTnaM4CqIZCt0L20Vd/jLS3F5P2zZAG AcnCuBDl733unP3tj5TwzGPB/2GGAKCq4rVYbUadeplxlKlBoDgey/C5aDLwddRm326D oBKPtKv8dNIWj4QUs04oBgxQ80rDHgonnYM5hnaYscslOk+plgETaRZxaOIMtHgIvy/n ksCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tspuasup; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 f61si18307404plf.258.2019.07.26.08.27.35; Fri, 26 Jul 2019 08:27:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tspuasup; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728542AbfGZP1f (ORCPT + 14 others); Fri, 26 Jul 2019 11:27:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:41860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728534AbfGZP1e (ORCPT ); Fri, 26 Jul 2019 11:27:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B6092205F4; Fri, 26 Jul 2019 15:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564154854; bh=UyfIQBivq2x50CDqDZcg91an+jfzeSUAaFuFUk2Ijeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tspuasupDiluzgJcxlHLa6wQ3WtETQ5qXbJpjMDSvN099u1ocsnUk/S2faNx8vZxn 1pJxHOVBiOJuBfQQgJZ2cQ5BYPYk+L5sS5DMVgPZ6sEAYBOCbj+9U4lnUsT+ro4xc/ FsVQk/w8blPT98hgbUg112Q4lAxwLOP2DatBvSpQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-spi@vger.kernel.org, Linus Walleij Subject: [PATCH 5.2 49/66] Revert "gpio/spi: Fix spi-gpio regression on active high CS" Date: Fri, 26 Jul 2019 17:24:48 +0200 Message-Id: <20190726152307.248624174@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190726152301.936055394@linuxfoundation.org> References: <20190726152301.936055394@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij commit da7f134972f473053ea9d721a1d8397546476dc4 upstream. This reverts commit fbbf145a0e0a0177e089c52275fbfa55763e7d1d. It seems I was misguided in my fixup, which was working at the time but did not work on the final v5.2. The patch tried to avoid a quirk the gpiolib code not to treat "spi-gpio" CS gpios "special" by enforcing them to be active low, in the belief that since the "spi-gpio" driver was parsing the device tree on its own, it did not care to inspect the "spi-cs-high" attribute on the device nodes. That's wrong. The SPI core was inspecting them inside the of_spi_parse_dt() funtion and setting SPI_CS_HIGH on the nodes, and the driver inspected this flag when driving the line. As of now, the core handles the GPIO and it will consistently set the GPIO descriptor to 1 to enable CS, strictly requireing the gpiolib to invert it. And the gpiolib should indeed enforce active low on the CS line. Device trees should of course put the right flag on the GPIO handles, but it used to not matter. If we don't enforce active low on "gpio-gpio" we may run into ABI backward compatibility issues, so revert this. Cc: linux-spi@vger.kernel.org Cc: stable@vger.kernel.org Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20190715204529.9539-1-linus.walleij@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpiolib-of.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -118,15 +118,8 @@ static void of_gpio_flags_quirks(struct * Legacy handling of SPI active high chip select. If we have a * property named "cs-gpios" we need to inspect the child node * to determine if the flags should have inverted semantics. - * - * This does not apply to an SPI device named "spi-gpio", because - * these have traditionally obtained their own GPIOs by parsing - * the device tree directly and did not respect any "spi-cs-high" - * property on the SPI bus children. */ - if (IS_ENABLED(CONFIG_SPI_MASTER) && - !strcmp(propname, "cs-gpios") && - !of_device_is_compatible(np, "spi-gpio") && + if (IS_ENABLED(CONFIG_SPI_MASTER) && !strcmp(propname, "cs-gpios") && of_property_read_bool(np, "cs-gpios")) { struct device_node *child; u32 cs;