From patchwork Sat Oct 12 02:56:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13833930 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 6BBCFD1A427 for ; Sat, 12 Oct 2024 02:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dYkBuOpC5npetPt+6Grw7MFHuSReVfBj6HkYtVQN2zk=; b=sDcME8eITHcEZAqJG5Ga8CcAF3 9JP/+HMa+lRSctQ+tbwPRhtXkvI63ZnA8oHNk6mU8bIEnPS3Mv6WfgOC/q7T3X7QKqWOn7xFSda9X wZ99jaTJ25nxjvkpSm1WRz7f1p5B8/g2lVfcpmzsO7UqeXECFw2wyEFVeWhG7ssxH+6TnrsBQi6SJ 5qyK+hg4yyZefp1iHFQNfzqU4I6Wh2ldoOGSpSQnSI7JXBx8x63gAmr28BQJNHRUM3ozeBEJ093wo RpZLB/ZmIU5Ljfe4Czb3Llo10YNMUVSqgj9j0aNKBG3wtJbZy9sDl5Ivj6WB3MOL/IcsNFCtKULfJ j6OMZzqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1szSLM-00000000QIj-1m5r; Sat, 12 Oct 2024 02:59:00 +0000 Received: from relay.smtp-ext.broadcom.com ([192.19.144.208]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1szSIf-00000000Q5m-2gZK for linux-arm-kernel@lists.infradead.org; Sat, 12 Oct 2024 02:56:15 +0000 Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 90639C0000FB; Fri, 11 Oct 2024 19:56:10 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 90639C0000FB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1728701770; bh=Abbcc8k9DiGUoOkzHxsND0zcdoWgeR778AZ6YENQdio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PgYD/w/zculjPxr1BZVdiTSOaT00rYUDn5DsbrVmXmpLGEv2vkISdhcN7De0DGEZy RNcSiNT/fdNMJNEjO0uhv5d5V4idr+r68LbUKU9VC0DmQS2MzYeLc34p4dgHEpXMWw j77CUvKkjz0KV8rRzBNapD1wz43WwyfRUyE1OSsQ= Received: from stbirv-lnx-1.igp.broadcom.net (stbirv-lnx-1.igp.broadcom.net [10.67.48.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id F19B718041CACA; Fri, 11 Oct 2024 19:56:09 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Broadcom internal kernel review list , Thierry Reding , linux-pwm@vger.kernel.org (open list:PWM SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE), justin.chen@broadcom.com Subject: [PATCH 1/2] dt-bindings: pwm: brcm,bcm7038: Document the 'open-drain' property Date: Fri, 11 Oct 2024 19:56:02 -0700 Message-Id: <20241012025603.1644451-2-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241012025603.1644451-1-florian.fainelli@broadcom.com> References: <20241012025603.1644451-1-florian.fainelli@broadcom.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241011_195613_848839_6F15D606 X-CRM114-Status: GOOD ( 11.35 ) 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 Document the 'open-drain' property that allows configuring the PWM controller outputs in open drain versus totem pole. Signed-off-by: Florian Fainelli --- Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.yaml b/Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.yaml index 119de3d7f9dd..12851c43a612 100644 --- a/Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.yaml +++ b/Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.yaml @@ -25,6 +25,12 @@ properties: clocks: maxItems: 1 + open-drain: + type: boolean + description: + Configure the outputs with open-drain structure, if omitted totem pole + structure is used. + required: - compatible - reg From patchwork Sat Oct 12 02:56:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13833931 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 45E26D1A427 for ; Sat, 12 Oct 2024 03:00:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CG/3CPqP2AGx1KogBhGeFTz1wEgoaB3R1819wOAVHko=; b=KDfx4ilfSlqlUiWpDEJKtl4rF1 8M3+Wufvsx8p+ytafAI1KwYtVdm7p6TkNgDx5mxI4K0hGe67aot6gEJUutZe4HtXuUpjEabhs51Hh thqNbh7vqwHda0o1cTbwFhOn4YXNt84hyPxoyQ3bA6/cDznhRqtZC4wml5oRcWZAVLJMBWZcCTvOc iymS6T2eq5p04fK914TUqgVXZfXHBktB/RdbsNFR6MYBaJU+XYRddq8xBH5Mo6r030c7ggl5V8t+3 vdLUt2bEZ2kkL9S+wdTSeWaqxLNpLcsNZEo5uUc+TWheQnhatWzlzruOBXIWeHoE+4nRcM6IvgT3J Ne4TQ8VQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1szSMg-00000000QNw-0Iow; Sat, 12 Oct 2024 03:00:22 +0000 Received: from relay.smtp-ext.broadcom.com ([192.19.144.207]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1szSIf-00000000Q61-2anx for linux-arm-kernel@lists.infradead.org; Sat, 12 Oct 2024 02:56:16 +0000 Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id AEFE0C0000F1; Fri, 11 Oct 2024 19:56:10 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com AEFE0C0000F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1728701770; bh=xcbxZozTzOOydjpY37v/9USjfCOMyBAeZHXAiSdCmSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y4qnNvNlFxWS1FvRM9AXNoGD0hKC+Ezc+/DYFDglxWqw2lgE+y/nwbPwHxgbvxfLD cpnzcl+UiVnmTjCJUEJdIhVvP6vWuL4xMjFIjEmdnyPwgzbc+lyzaYGxBpCrDaGhWm duAAIAk1m/EhC02do1VBTXbYBskcBYHn6ZsuxraY= Received: from stbirv-lnx-1.igp.broadcom.net (stbirv-lnx-1.igp.broadcom.net [10.67.48.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 5825318041CAC6; Fri, 11 Oct 2024 19:56:10 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Broadcom internal kernel review list , Thierry Reding , linux-pwm@vger.kernel.org (open list:PWM SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE), justin.chen@broadcom.com Subject: [PATCH 2/2] pwm: brcmstb: Do not assume open drain configuration Date: Fri, 11 Oct 2024 19:56:03 -0700 Message-Id: <20241012025603.1644451-3-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241012025603.1644451-1-florian.fainelli@broadcom.com> References: <20241012025603.1644451-1-florian.fainelli@broadcom.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241011_195613_848835_C5108B13 X-CRM114-Status: GOOD ( 14.78 ) 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 Read the 'open-drain' property to determine whether the PWM controller output(s) should be configured in open-drain versus totem pole mode. Fixes: 3a9f5957020f ("pwm: Add Broadcom BCM7038 PWM controller support") Signed-off-by: Florian Fainelli --- drivers/pwm/pwm-brcmstb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c index 0fdeb0b2dbf3..b7cecd36ed57 100644 --- a/drivers/pwm/pwm-brcmstb.c +++ b/drivers/pwm/pwm-brcmstb.c @@ -55,6 +55,7 @@ struct brcmstb_pwm { void __iomem *base; struct clk *clk; struct pwm_chip chip; + bool open_drain; }; static inline u32 brcmstb_pwm_readl(struct brcmstb_pwm *p, @@ -176,6 +177,7 @@ static int brcmstb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, static inline void brcmstb_pwm_enable_set(struct brcmstb_pwm *p, unsigned int channel, bool enable) { + u32 oe_mask = p->open_drain ? CTRL_OPENDRAIN : 0; unsigned int shift = channel * CTRL_CHAN_OFFS; u32 value; @@ -183,9 +185,9 @@ static inline void brcmstb_pwm_enable_set(struct brcmstb_pwm *p, if (enable) { value &= ~(CTRL_OEB << shift); - value |= (CTRL_START | CTRL_OPENDRAIN) << shift; + value |= (CTRL_START | oe_mask) << shift; } else { - value &= ~((CTRL_START | CTRL_OPENDRAIN) << shift); + value &= ~((CTRL_START | oe_mask) << shift); value |= CTRL_OEB << shift; } @@ -244,6 +246,7 @@ static int brcmstb_pwm_probe(struct platform_device *pdev) platform_set_drvdata(pdev, p); + p->open_drain = device_property_read_bool(&pdev->dev, "open-drain"); p->chip.dev = &pdev->dev; p->chip.ops = &brcmstb_pwm_ops; p->chip.npwm = 2;