From patchwork Tue Aug 27 05:55:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Vadapalli X-Patchwork-Id: 13778883 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 E6F9CC52D6F for ; Tue, 27 Aug 2024 05:58:43 +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-Type: Content-Transfer-Encoding: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=QPaO3QsNv5NaAoPgz9ubqhBCpY5Raa+kHO4t56mOjpY=; b=QPd0HshSwlwW1uDS/09Mluha4u s6gvAq62G9fkLXFmpoBLPgFpFoO+V8Pgvp6YT6NH9yo12Mu3Hpg93/Uxfvt+CB45J/gTiwjWqgFYh D/lyjMKNcHDCvxZ72pPagiWdHlb4sY9tlLO1tNfP3FSZOnrQleUQTrF+kn5ODv7XiVxlLNW5vIyD2 heQG2Rw+ZkBoPDN12ETwgRADOJikRGXAdGjmBAoVkVPkuWM4gU2tD2Dn+DGt9280Sr2epT0CmU+Bf TiqeU6VOlzlhwPkuO2pscgktqTvxiE12RboOS92TivcNe7PB0Q9iSYxDzP914mNWN4vA9vlBGIO7I 7hgu5ytw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sipDu-00000009wPt-49MP; Tue, 27 Aug 2024 05:58:34 +0000 Received: from lelv0143.ext.ti.com ([198.47.23.248]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sipBc-00000009vvU-3ogu for linux-arm-kernel@lists.infradead.org; Tue, 27 Aug 2024 05:56:14 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 47R5txuH086225; Tue, 27 Aug 2024 00:55:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1724738159; bh=QPaO3QsNv5NaAoPgz9ubqhBCpY5Raa+kHO4t56mOjpY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=VzCWsZzDi+m+xIcvXoVZOhTdK2VfVQSNL7nRwMstghofeXlRItvqGrhRN90hpkDBq ZE29evwNoUL0nAubgPL9+PkPOxKe4yM200Uo8mZibwYdM+ommesrbLfsjIh+4LpcAl X1sHoE/vslgF9bPrsYQy9QyqLTAId1ENJol57t5M= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 47R5txm2086475 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Aug 2024 00:55:59 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 27 Aug 2024 00:55:59 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 27 Aug 2024 00:55:59 -0500 Received: from uda0492258.dhcp.ti.com (uda0492258.dhcp.ti.com [10.24.72.81]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 47R5tn7e103422; Tue, 27 Aug 2024 00:55:54 -0500 From: Siddharth Vadapalli To: , , , , , , , , CC: , , , , , Subject: [PATCH v3 1/2] dt-bindings: PCI: ti,j721e-pci-host: Add ACSPCIE proxy control property Date: Tue, 27 Aug 2024 11:25:47 +0530 Message-ID: <20240827055548.901285-2-s-vadapalli@ti.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240827055548.901285-1-s-vadapalli@ti.com> References: <20240827055548.901285-1-s-vadapalli@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_225613_058746_8CDAF94C X-CRM114-Status: GOOD ( 10.57 ) 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 Add the "ti,syscon-acspcie-proxy-ctrl" device-tree property which is used to obtain a reference to the ACSPCIE Proxy Control register along with the details of the PAD IO Buffer output enable bits. The ACSPCIE Proxy Control register is used to drive the reference clock for the PCIe Endpoint device via the PAD IO Buffers of the ACSPCIE module. The ACSPCIE module can be used as an alternative to either an on-board clock generator or an external clock generator for providing the reference clock to the PCIe Endpoint device. Signed-off-by: Siddharth Vadapalli Acked-by: Krzysztof Kozlowski --- v2: https://lore.kernel.org/r/20240729092855.1945700-2-s-vadapalli@ti.com/ Changes since v2: - Rebased patch on next-20240826. v1: https://lore.kernel.org/r/20240715120936.1150314-3-s-vadapalli@ti.com/ Changes since v1: - Collected Acked-by tag from: Krzysztof Kozlowski https://lore.kernel.org/r/1caa0c9a-1de7-41db-be2b-557b49f4a248@kernel.org/ .../devicetree/bindings/pci/ti,j721e-pci-host.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml b/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml index 15a2658ceeef..69b499c96c71 100644 --- a/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml +++ b/Documentation/devicetree/bindings/pci/ti,j721e-pci-host.yaml @@ -38,6 +38,16 @@ properties: - const: reg - const: cfg + ti,syscon-acspcie-proxy-ctrl: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: Phandle to the ACSPCIE Proxy Control Register + - description: Bitmask corresponding to the PAD IO Buffer + output enable fields (Active Low). + description: Specifier for enabling the ACSPCIE PAD outputs to drive + the reference clock to the Endpoint device. + ti,syscon-pcie-ctrl: $ref: /schemas/types.yaml#/definitions/phandle-array items: From patchwork Tue Aug 27 05:55:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Vadapalli X-Patchwork-Id: 13778882 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 4D2F0C52D6F for ; Tue, 27 Aug 2024 05:57:59 +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-Type: Content-Transfer-Encoding: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=iCNZUhycfyj1kY3kt5uCHhGpAcrMxjqleOLxhg4VqI8=; b=Hfs+tGiBlmIuxovm1w7bIAlApD 3d8OhLhiX09wrQl5dMzY/0oBf8eQ7Q7lSFdd0UnS+AN2QvJY2m/BCQP5mdAw7l+ctqpTrsytKeVMd CXa+NSdfLtNyUDv+FHUJPePf/5lWKbHImaVkTNI0f7Rxhzae5kycGoHBdWrsGG9vRM3p6Yf1t2nig vnJqzdDl8Yt2Dk8E49BVOYMfkqr1Gudj1fOOHmuHVFpgR+XZh68HMDhzeZDwAIQ6/1KBZeNvjcLLz CBULupVG4xtxNF3e7W5UhNIDHTzcTZkViEWYpFWp4Lh8axLDIzwpfNO50uK6OYyrOI7ITDRIZ2l2D m/74zXdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sipDA-00000009wIa-1H9x; Tue, 27 Aug 2024 05:57:48 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sipBb-00000009vvA-2Uhr for linux-arm-kernel@lists.infradead.org; Tue, 27 Aug 2024 05:56:13 +0000 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 47R5u4rn116401; Tue, 27 Aug 2024 00:56:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1724738164; bh=iCNZUhycfyj1kY3kt5uCHhGpAcrMxjqleOLxhg4VqI8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=el/kp47H5X5wCO0MolnMuiy8U2xqIaqKq+kgreQOnGv6SGeowWeSRMe2jiV2uk1fJ 7OfyyPmNu8rnTdnNqMDXvL70B+9PwBwmiJk6gvlzJ+zMQ7O8AX7jBpb9oqywRxeTYl 1BZ2brOolUF3HoaxC3PFD06DnfjcXB7dGNIGJBdg= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 47R5u4gl094810 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Aug 2024 00:56:04 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 27 Aug 2024 00:56:04 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 27 Aug 2024 00:56:04 -0500 Received: from uda0492258.dhcp.ti.com (uda0492258.dhcp.ti.com [10.24.72.81]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 47R5tn7f103422; Tue, 27 Aug 2024 00:55:59 -0500 From: Siddharth Vadapalli To: , , , , , , , , CC: , , , , , Subject: [PATCH v3 2/2] PCI: j721e: Enable ACSPCIE Refclk if "ti,syscon-acspcie-proxy-ctrl" exists Date: Tue, 27 Aug 2024 11:25:48 +0530 Message-ID: <20240827055548.901285-3-s-vadapalli@ti.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240827055548.901285-1-s-vadapalli@ti.com> References: <20240827055548.901285-1-s-vadapalli@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_225611_757109_83BF9F3C X-CRM114-Status: GOOD ( 16.98 ) 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 The ACSPCIE module is capable of driving the reference clock required by the PCIe Endpoint device. It is an alternative to on-board and external reference clock generators. Enabling the output from the ACSPCIE module's PAD IO Buffers requires clearing the "PAD IO disable" bits of the ACSPCIE_PROXY_CTRL register in the CTRL_MMR register space. Add support to enable the ACSPCIE reference clock output using the optional device-tree property "ti,syscon-acspcie-proxy-ctrl". Signed-off-by: Siddharth Vadapalli --- v2: https://lore.kernel.org/r/20240729092855.1945700-3-s-vadapalli@ti.com/ Changes since v2: - Rebased patch on next-20240826. v1: https://lore.kernel.org/r/20240715120936.1150314-4-s-vadapalli@ti.com/ Changes since v1: - Addressed Bjorn's feedback at: https://lore.kernel.org/r/20240725211841.GA859405@bhelgaas/ with the following changes: 1) Updated $subject and commit message to indicate that this patch enables ACSPCIE reference clock output if the DT property is present. 2) Updated macro and comments to indicate that the BITS correspond to disabling ACSPCIE output, due to which clearing them enables the reference clock output. 3) Replaced "PAD" with "refclk" both in the function name and in the error prints. 4) Wrapped lines to be within the 80 character limit to match the rest of the driver. drivers/pci/controller/cadence/pci-j721e.c | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c index 85718246016b..ed42b2229483 100644 --- a/drivers/pci/controller/cadence/pci-j721e.c +++ b/drivers/pci/controller/cadence/pci-j721e.c @@ -44,6 +44,7 @@ enum link_status { #define J721E_MODE_RC BIT(7) #define LANE_COUNT(n) ((n) << 8) +#define ACSPCIE_PAD_DISABLE_MASK GENMASK(1, 0) #define GENERATION_SEL_MASK GENMASK(1, 0) struct j721e_pcie { @@ -220,6 +221,34 @@ static int j721e_pcie_set_lane_count(struct j721e_pcie *pcie, return ret; } +static int j721e_enable_acspcie_refclk(struct j721e_pcie *pcie, + struct regmap *syscon) +{ + struct device *dev = pcie->cdns_pcie->dev; + struct device_node *node = dev->of_node; + u32 mask = ACSPCIE_PAD_DISABLE_MASK; + struct of_phandle_args args; + u32 val; + int ret; + + ret = of_parse_phandle_with_fixed_args(node, + "ti,syscon-acspcie-proxy-ctrl", + 1, 0, &args); + if (!ret) { + /* Clear PAD IO disable bits to enable refclk output */ + val = ~(args.args[0]); + ret = regmap_update_bits(syscon, 0, mask, val); + if (ret) + dev_err(dev, "failed to enable ACSPCIE refclk: %d\n", + ret); + } else { + dev_err(dev, + "ti,syscon-acspcie-proxy-ctrl has invalid arguments\n"); + } + + return ret; +} + static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie) { struct device *dev = pcie->cdns_pcie->dev; @@ -259,6 +288,15 @@ static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie) return ret; } + /* Enable ACSPCIE refclk output if the optional property exists */ + syscon = syscon_regmap_lookup_by_phandle_optional(node, + "ti,syscon-acspcie-proxy-ctrl"); + if (syscon) { + ret = j721e_enable_acspcie_refclk(pcie, syscon); + if (ret) + return ret; + } + return 0; }