From patchwork Thu Jul 14 18:33:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12918403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 26F3DC43334 for ; Thu, 14 Jul 2022 18:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GANXSQfOzcA3k+raHK/qZB1cvf3VfMvGF9G3LvpKFb0=; b=HxW/CMHbQvHvrz rNFQ9qH458cqpHdwOEGBtRlctQs6nI1zvpT/YH/k7rrfd74m6YGhLfkhNH184CeysSOmiYX+tGHkC Nj8QLa7e3LSLO7dRbc7VuIqpcmM8DmedtZJdLwbRh2KZpA+9qt6+0W2f6dulQMUJPAIXniPAFZcbv Fo0o7lQ9nHsEStGgCtcvAIzs52MaVbomKN842FgvwMjbyM2Sdssmv04ofL/9hgA1sfDLahdtBiD5D dNt86PiHzQ7bPfTSXvMU6wUejYxKterUtt+VpoyQ1kcpYI9+9Zrs1pOYuvfnDrZvkKkyJJujd0bLc FSei/x0JxWWh+0LJpB8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oC3fI-00HDA5-VU; Thu, 14 Jul 2022 18:34:21 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oC3eq-00HCq6-8o for linux-arm-kernel@lists.infradead.org; Thu, 14 Jul 2022 18:33:55 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id BA341CE2B15; Thu, 14 Jul 2022 18:33:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B1EFC34114; Thu, 14 Jul 2022 18:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657823627; bh=uYJqubEioTmV1YTvZ/Dq1JpUQFHEuaX4No8uowtwz4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iCuhAmcmtvA9NNwhysrRYtWPIC3q7sRKn1GqGl1jVy6Uacb6MLCcZ/akrntoT2MRN R/KADwJ5BQqoY4Ry6pE63OW+hSSeUUHGYwbCqQouobhH3KXQIc8b30tbG2My95JAyR yh0EMxN8W5Jvi8HCZ2L2HTq0QTC9ZCviSUEj+n0Ix5/caQO2B1GXP9Ue3h5zSbgJYJ AUN2yZnY2EINbzZwafDaoESx3qcZ1/tPrK3dZ8KySJsyOieIzVqvt9WN+BlsxpyYgI QAuIvIpejZgfHcqPmcBOr6fB54P1xLpClemDSZGR0KjzXGL/mR/4Lim0ffAmKPS7qP 1qvabzRWyPu6A== Received: by pali.im (Postfix) id C1D6B1295; Thu, 14 Jul 2022 20:33:43 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , Lee Jones , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= 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 Message-Id: <20220714183328.4137-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220714115515.5748-1-pali@kernel.org> References: <20220714115515.5748-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220714_113352_558011_39F2EC06 X-CRM114-Status: GOOD ( 17.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 --- 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))