devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: "Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Gregory Clement" <gregory.clement@bootlin.com>,
	"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
	"Marek Behún" <kabel@kernel.org>
Cc: linux-pwm@vger.kernel.org, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms
Date: Thu, 14 Jul 2022 20:33:25 +0200	[thread overview]
Message-ID: <20220714183328.4137-1-pali@kernel.org> (raw)
In-Reply-To: <20220714115515.5748-1-pali@kernel.org>

pwm support incompatible with Armada 80x0/70x0 API is not only in
Armada 370, but also in Armada XP, 38x and 39x. So basically every non-A8K
platform. Fix check for pwm support appropriately.

Fixes: 85b7d8abfec7 ("gpio: mvebu: add pwm support for Armada 8K/7K")
Signed-off-by: Pali Rohár <pali@kernel.org>

---
Changes in v2:
* reverse the if/else order per Baruch request
---
 drivers/gpio/gpio-mvebu.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 2db19cd640a4..de1e7a1a76f2 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -793,8 +793,12 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
 	u32 offset;
 	u32 set;
 
-	if (of_device_is_compatible(mvchip->chip.of_node,
-				    "marvell,armada-370-gpio")) {
+	if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {
+		int ret = of_property_read_u32(dev->of_node,
+					       "marvell,pwm-offset", &offset);
+		if (ret < 0)
+			return 0;
+	} else {
 		/*
 		 * There are only two sets of PWM configuration registers for
 		 * all the GPIO lines on those SoCs which this driver reserves
@@ -804,13 +808,6 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
 		if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm"))
 			return 0;
 		offset = 0;
-	} else if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {
-		int ret = of_property_read_u32(dev->of_node,
-					       "marvell,pwm-offset", &offset);
-		if (ret < 0)
-			return 0;
-	} else {
-		return 0;
 	}
 
 	if (IS_ERR(mvchip->clk))
-- 
2.20.1


  parent reply	other threads:[~2022-07-14 18:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 11:55 [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
2022-07-14 11:55 ` [PATCH 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
2022-07-14 11:55 ` [PATCH 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
2022-07-14 11:55 ` [PATCH 4/4] ARM: dts: armada-39x: " Pali Rohár
2022-07-14 13:14 ` [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Baruch Siach
2022-07-14 13:19 ` Andrew Lunn
2022-07-14 18:33 ` Pali Rohár [this message]
2022-07-14 18:33   ` [PATCH v2 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
2022-07-18 21:18     ` Rob Herring
2022-07-14 18:33   ` [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
2022-07-16 14:40     ` Uwe Kleine-König
2022-07-16 14:50       ` Pali Rohár
2022-07-16 15:07         ` Uwe Kleine-König
2022-07-16 16:09           ` Pali Rohár
2022-07-25 20:04             ` Uwe Kleine-König
2022-08-31 14:30               ` Pali Rohár
2022-09-30 23:34     ` Pali Rohár
2022-10-09 12:05       ` Pali Rohár
2022-11-01 22:44         ` Pali Rohár
2022-11-28  0:05     ` Gregory CLEMENT
2022-12-31  7:18       ` Klaus Kudielka
2022-11-28 20:24     ` Chris Packham
2022-07-14 18:33   ` [PATCH v2 4/4] ARM: dts: armada-39x: " Pali Rohár
2022-11-28  0:05     ` Gregory CLEMENT
2022-09-24 10:34   ` [PATCH v2 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
2022-09-26  7:20   ` Bartosz Golaszewski

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=20220714183328.4137-1-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=brgl@bgdev.pl \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=kabel@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).