All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jay Fang <f.fangjian@huawei.com>
To: <broonie@kernel.org>, <linus.walleij@linaro.org>
Cc: <linux-spi@vger.kernel.org>, <linux-gpio@vger.kernel.org>,
	<linuxarm@huawei.com>, <huangdaode@huawei.com>,
	<tangzihao1@hisilicon.com>
Subject: [PATCH 2/2] Revert "gpio: of: Handle SPI chipselect legacy bindings"
Date: Thu, 6 May 2021 11:00:17 +0800	[thread overview]
Message-ID: <1620270017-52643-3-git-send-email-f.fangjian@huawei.com> (raw)
In-Reply-To: <1620270017-52643-1-git-send-email-f.fangjian@huawei.com>

This reverts commit 6953c57ab1721ce57914fc5741d0ce0568756bb0.

The latter introduced a generic implementation to resolve it by SPI core
and is not needed anymore after the previous commit.

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
---
 drivers/gpio/gpiolib-of.c | 51 ++---------------------------------------------
 1 file changed, 2 insertions(+), 49 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index baf0153..b8337f8b 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -132,8 +132,7 @@ bool of_gpio_need_valid_mask(const struct gpio_chip *gc)
 
 static void of_gpio_flags_quirks(struct device_node *np,
 				 const char *propname,
-				 enum of_gpio_flags *flags,
-				 int index)
+				 enum of_gpio_flags *flags)
 {
 	/*
 	 * Some GPIO fixed regulator quirks.
@@ -172,52 +171,6 @@ static void of_gpio_flags_quirks(struct device_node *np,
 			of_node_full_name(np));
 	}
 
-	/*
-	 * 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.
-	 */
-	if (IS_ENABLED(CONFIG_SPI_MASTER) && !strcmp(propname, "cs-gpios") &&
-	    of_property_read_bool(np, "cs-gpios")) {
-		struct device_node *child;
-		u32 cs;
-		int ret;
-
-		for_each_child_of_node(np, child) {
-			ret = of_property_read_u32(child, "reg", &cs);
-			if (ret)
-				continue;
-			if (cs == index) {
-				/*
-				 * SPI children have active low chip selects
-				 * by default. This can be specified negatively
-				 * by just omitting "spi-cs-high" in the
-				 * device node, or actively by tagging on
-				 * GPIO_ACTIVE_LOW as flag in the device
-				 * tree. If the line is simultaneously
-				 * tagged as active low in the device tree
-				 * and has the "spi-cs-high" set, we get a
-				 * conflict and the "spi-cs-high" flag will
-				 * take precedence.
-				 */
-				if (of_property_read_bool(child, "spi-cs-high")) {
-					if (*flags & OF_GPIO_ACTIVE_LOW) {
-						pr_warn("%s GPIO handle specifies active low - ignored\n",
-							of_node_full_name(child));
-						*flags &= ~OF_GPIO_ACTIVE_LOW;
-					}
-				} else {
-					if (!(*flags & OF_GPIO_ACTIVE_LOW))
-						pr_info("%s enforce active low on chipselect handle\n",
-							of_node_full_name(child));
-					*flags |= OF_GPIO_ACTIVE_LOW;
-				}
-				of_node_put(child);
-				break;
-			}
-		}
-	}
-
 	/* Legacy handling of stmmac's active-low PHY reset line */
 	if (IS_ENABLED(CONFIG_STMMAC_ETH) &&
 	    !strcmp(propname, "snps,reset-gpio") &&
@@ -263,7 +216,7 @@ static struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
 		goto out;
 
 	if (flags)
-		of_gpio_flags_quirks(np, propname, flags, index);
+		of_gpio_flags_quirks(np, propname, flags);
 
 	pr_debug("%s: parsed '%s' property of node '%pOF[%d]' - status (%d)\n",
 		 __func__, propname, np, index,
-- 
2.7.4


  parent reply	other threads:[~2021-05-06  3:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06  3:00 [PATCH 0/2] spi: Correct CS GPIOs polarity when using GPIO descriptors Jay Fang
2021-05-06  3:00 ` [PATCH 1/2] " Jay Fang
2021-05-06  3:00 ` Jay Fang [this message]
     [not found] ` <CAHp75Vfr8t9UVqVn6hLSN6Mi3=iNAn612eE-qKq9HfrwNhpg3Q@mail.gmail.com>
     [not found]   ` <CAHp75Vei0QGaKiq5Nai7Gsa=jcMSipaXV_6qZbBy=f0OrN=DHQ@mail.gmail.com>
2021-05-06  9:11     ` [PATCH 0/2] " Jay Fang
2021-05-06  9:44       ` Andy Shevchenko
2021-05-06  9:51         ` Andy Shevchenko
2021-05-06 11:06         ` Linus Walleij
2021-05-06 11:24           ` Mark Brown
     [not found]           ` <CAHp75Veoqnd3Hgzq8DAz-_=QxMt-+r608dkzPp67YA5eitLJNw@mail.gmail.com>
2021-05-06 11:34             ` Mark Brown
2021-05-06 12:17               ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1620270017-52643-3-git-send-email-f.fangjian@huawei.com \
    --to=f.fangjian@huawei.com \
    --cc=broonie@kernel.org \
    --cc=huangdaode@huawei.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=tangzihao1@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.