From patchwork Thu Feb 18 04:49:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 12093035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19BF3C433E0 for ; Thu, 18 Feb 2021 04:50:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA7B064E3E for ; Thu, 18 Feb 2021 04:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230241AbhBREuz (ORCPT ); Wed, 17 Feb 2021 23:50:55 -0500 Received: from mail-bn8nam11on2058.outbound.protection.outlook.com ([40.107.236.58]:48193 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229864AbhBREuy (ORCPT ); Wed, 17 Feb 2021 23:50:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Aq3mSp0qKolhZeLKMoeoIUma1bUcx2cClTsQj5yEuXT1D9vcNEVU/8OsDlhxrGa8A8CglLLuJFRLXqL0oVHPZbAZTNoXgEYuOUsvt1ofkXTHl3iw7HmsAokgOT+40UhTZHf9B0K21z7K1TE7QS08dsq+PSW0aXWHpPoRHkNgvQHpY79kNOTpXfEjWuxv5kEJnk8n7qQOiOnCklgHOR3LKYP+bSI52LxcPCGSVHtXXTsshqo+o1hf+dh8ONI6lxugjPfiZhOj7XLrRGaOsmlHqv4ISyWXMzk3rXimLC7aa5xVK6dCeIcmD9Z2jTrRej4aWR26wi9wGkpYUjgiweth0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3ZHjvNyh1L9nyp7c4qfkne5sYL5gABUAHv0lMunD680=; b=gs7xjrJUcBuxcm4U3gpzhueM5fG8WIvtbS4sTtRz9kMh0xi90vblHdGj2ffREhKr7TQB+Ef1vSvTedYXM/yQXi8OSDZsMAubmowNz+V+oCV1VW4tpxFgiY4aFuH9HQJN7f4geQR/jDY7gHVoKET8MmOmQeQXcKU4IUFQRqAEkAw8Mc3nyHpp3J1SNojBsRpObZKFo4jlxRbsB0O1Hsmev+IP2GBNt+MvXw3i+paNqF+J9kaX1qMKU7cKi7HfL0VflVOJRMDjFxv408ati35rKN+Xkm+OhZ/KQ6qqxXZ9p+3S1FYhBBww9AyBHFV52jjiKXh06YGKU9lokwSBjhBBjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3ZHjvNyh1L9nyp7c4qfkne5sYL5gABUAHv0lMunD680=; b=A0gOQOZoiDsFLNRb5vsR+xmg2OPER+TYmx59p3crQrHNCRSJTEg+uQ/FJl/ulrIJx4ndVOs8jL70IBFM5InchtmLnjF6StjaLcbDGE9cD5qFzCvRjlXij9jk0HL6qctXURLqsvg/Smw4QbAZuLIKQQeVMLgHsmuhBCUjfXFKbNk= Received: from DM5PR10CA0016.namprd10.prod.outlook.com (2603:10b6:4:2::26) by MN2PR02MB7024.namprd02.prod.outlook.com (2603:10b6:208:205::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Thu, 18 Feb 2021 04:50:01 +0000 Received: from DM3NAM02FT010.eop-nam02.prod.protection.outlook.com (2603:10b6:4:2:cafe::d) by DM5PR10CA0016.outlook.office365.com (2603:10b6:4:2::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT010.mail.protection.outlook.com (10.13.5.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:00 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Wed, 17 Feb 2021 20:49:59 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Wed, 17 Feb 2021 20:49:59 -0800 Envelope-to: shubhrajyoti.datta@xilinx.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, mturquette@baylibre.com, sboyd@kernel.org, gregkh@linuxfoundation.org, shubhrajyoti.datta@gmail.com, miquel.raynal@bootlin.com Received: from [10.140.6.59] (port=35054 helo=xhdshubhraj40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lCbGJ-0004qG-4P; Wed, 17 Feb 2021 20:49:59 -0800 From: Shubhrajyoti Datta To: CC: , , , , , , "Shubhrajyoti Datta" Subject: [PATCH v9 1/7] dt-bindings: add documentation of xilinx clocking wizard Date: Thu, 18 Feb 2021 10:19:45 +0530 Message-ID: <1613623791-4598-2-git-send-email-shubhrajyoti.datta@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> References: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9abe0f89-1aeb-41b5-d62a-08d8d3c8a639 X-MS-TrafficTypeDiagnostic: MN2PR02MB7024: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:439; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fir4Sv+8fouCsa1MkdthmehgsOavIKOuh7EFR+uFtgWg1uTnmcJV2k8h7omLw1yXADy4Jv3Httjk4e6vNduNCNvbs/szQHKZiYCV4NyF9NLTZPjkWUih/MvulaOFam/PF/ddk/1BlSe5zZPvrFGq5ad4exRh2aWxyfov5ITbLcgbcIeli4Aloz1cNNAjhhvZg1bqPO58hYYwuOGmA41jRrjr4ZO3E1jXN9X8qxusWcie5Ggzi+6d++liJEHrgHyP5W4UFSPZ1E26QFA9Oso+a83d5A7FdFCStjwuasBHqO+QZCKEW4gFqVzfweWQ4xtaVI6pWJvvhG3pNd78UdrsPMsmBwtoQUhx+yJptiDi+DKUfrU2lL+q8Nvdoy37m0XX4heUkgjD8mMwoAr/e8HsTJHnKQnCuCWt96Y5xbkUwN8VvJ3e3xQGpASICR5DtXQWWMOYLxeX2ZxKZOLD61XGT7v05o1TrdsYLwX/2Z/YpdUtqYIn97fJ2xIUPAx3dRqaIwniy7u7NMOb4U6k3p1Q+35omEitTlrKceaT7sR5KCmjPQoyFNs/9hVPLrWcRBd2NgHIfY4tOWHv+seXegTC/EF0zVx9CRBsw8mIEU+tMS6iaASyxuOI3OPfwwowX8AK8CIWUTwPsSWiAnXxWg0PeMnYQ/YQ6vEZERsuVcP85exsnAxmE3gCshRzA/Iw6TVB2R5XlfCL/7rpXlUAtTAQckRFapBmQegPnJVyeohWxp6idiPUUtbSvaxQqUyIkEcyKebvAWCFp7o8NFqhlT27PQ== X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(376002)(39860400002)(396003)(346002)(136003)(36840700001)(46966006)(356005)(2616005)(186003)(44832011)(336012)(7636003)(83380400001)(107886003)(82740400003)(4326008)(36756003)(6666004)(26005)(478600001)(5660300002)(82310400003)(426003)(9786002)(8936002)(6916009)(54906003)(316002)(36906005)(70586007)(36860700001)(2906002)(7696005)(8676002)(47076005)(70206006)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 04:50:00.7753 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9abe0f89-1aeb-41b5-d62a-08d8d3c8a639 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT010.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB7024 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Add the devicetree binding for the xilinx clocking wizard. Signed-off-by: Shubhrajyoti Datta --- v6: Fix a yaml warning v7: Add vendor prefix speed-grade v8: Fix the warnings v9: Fix the warnings .../bindings/clock/xlnx,clocking-wizard.yaml | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml diff --git a/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml b/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml new file mode 100644 index 0000000..d209140 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml @@ -0,0 +1,65 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/clock/xlnx,clocking-wizard.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Xilinx clocking wizard + +maintainers: + - Shubhrajyoti Datta + +description: + The clocking wizard is a soft ip clocking block of Xilinx versal. It + reads required input clock frequencies from the devicetree and acts as clock + clock output. + +properties: + compatible: + const: xlnx,clocking-wizard + + reg: + maxItems: 1 + + "#clock-cells": + const: 1 + + clocks: + items: + - description: clock input + - description: axi clock + + clock-names: + items: + - const: clk_in1 + - const: s_axi_aclk + + clock-output-names: true + + xlnx,speed-grade: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [1, 2, 3] + description: + Speed grade of the device. + +required: + - compatible + - reg + - "#clock-cells" + - clocks + - clock-names + - xlnx,speed-grade + +additionalProperties: false + +examples: + - | + clock-controller { + compatible = "xlnx,clocking-wizard"; + reg = <0xb0000000 0x10000>; + #clock-cells = <1>; + xlnx,speed-grade = <1>; + clock-names = "clk_in1", "s_axi_aclk"; + clocks = <&clkc 15>, <&clkc 15>; + }; +... From patchwork Thu Feb 18 04:49:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 12093037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30790C433E9 for ; Thu, 18 Feb 2021 04:50:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFCFF60C3D for ; Thu, 18 Feb 2021 04:50:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229864AbhBREu4 (ORCPT ); Wed, 17 Feb 2021 23:50:56 -0500 Received: from mail-eopbgr700078.outbound.protection.outlook.com ([40.107.70.78]:14753 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230233AbhBREuz (ORCPT ); Wed, 17 Feb 2021 23:50:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kAA2mf5j24UshFXsYHXV4zScj533dDZk9PtsCmTy/p7ivF0CUmT/ZPmIVvqDakcg0Sh/jZt55xHj5L5A2J5EzYUEVOcVxMr1s9owIKI/ydQYlbOYdFBq8Q5l78JC3+OeRa3+v91HEgggeASV6DeS9wh1Qn+mEX+y8qSyTzjS4FP8bSt2WxvVER9M3DthkQNW0dE7TYYHhj5tP3oo+uG9wPBaOzQVDJxpC6lt9/HU6Q07MzpR4+/NxAEN3EL/lB5uqianGjnXAUho1cLRZ5hvpYAubcqZyNqNkiPEwq4RQJd94Jga73GdK63GH0AsHNF0OX0oOcdhAt6PczEHMHMqAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i9HFXu83m4J//VRK9w29Bs0VemELGZUJC8A4+caaois=; b=bNofYs5sYn+u1aPqxWp8XLqtMoPxmwaW0eEPitpV1TuPWIjetAkREdtsyRg2RXBjxQYBCF5mFT/V3JxPSZU18yo/L6R3Q/Ukqudjxw6RwOZ3zvuUTrmdZcvXWrJFNgGdlPP92Pd1nfnJwDPi8Yn9A4dj2tYEYdn3gWJnVJwTkr80fldeQKXf2cgdSh1Nfee9kmbaUDcu8dqLV6couu48AmcjNcGdAukRk0XvDDhwe7fa7uAlvfgY5LxZExc9YMznF3OoHDPN0MnxD5ihgidS8Y2cLV3123XowZqtEJIG2uZvWlpazhSXx1S0n4SCdDJCxTowXypuHIe8omk9hC+qJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i9HFXu83m4J//VRK9w29Bs0VemELGZUJC8A4+caaois=; b=s/B5DwrOxa5EURCUKvsPaMeO9UXMvp8zKQ4z4wfTx9Hb7JBBz8FAT1o66zZISlY6TWvM5jLAbOSMgn+wPrEFssMsHLl3o2eX7o8nReUlfsdAHzPkpyWLa+5WaDDYdVJHDlqdW5AE+/HJFzVn8ZGzBR/hlF5CEIsR3A3FLS8f2yo= Received: from DM5PR10CA0002.namprd10.prod.outlook.com (2603:10b6:4:2::12) by BYAPR02MB5941.namprd02.prod.outlook.com (2603:10b6:a03:11c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 04:50:06 +0000 Received: from DM3NAM02FT010.eop-nam02.prod.protection.outlook.com (2603:10b6:4:2:cafe::94) by DM5PR10CA0002.outlook.office365.com (2603:10b6:4:2::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT010.mail.protection.outlook.com (10.13.5.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:05 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Wed, 17 Feb 2021 20:50:02 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Wed, 17 Feb 2021 20:50:02 -0800 Envelope-to: shubhrajyoti.datta@xilinx.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, mturquette@baylibre.com, sboyd@kernel.org, gregkh@linuxfoundation.org, shubhrajyoti.datta@gmail.com, miquel.raynal@bootlin.com Received: from [10.140.6.59] (port=35054 helo=xhdshubhraj40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lCbGM-0004qG-7d; Wed, 17 Feb 2021 20:50:02 -0800 From: Shubhrajyoti Datta To: CC: , , , , , , "Shubhrajyoti Datta" Subject: [PATCH v9 2/7] clk: clock-wizard: Add the clockwizard to clk directory Date: Thu, 18 Feb 2021 10:19:46 +0530 Message-ID: <1613623791-4598-3-git-send-email-shubhrajyoti.datta@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> References: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4792213b-f466-46c2-2630-08d8d3c8a94d X-MS-TrafficTypeDiagnostic: BYAPR02MB5941: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RjwKMF6OgJF2HltZ6c4wtS11wk6PuNBBDSckIW9Xp3xGOSCTCTfAlaYdygMZ+sY35yKpDnCpYqaTQdkxEtS7vdHmw20tMwYgnaWOnX0Jd0qvl9IQFLxOB1vMM0CHWm/xWHs1AEgl5mKZ/BYzHCoje7qh9QZO98I80dCQ2lm8WbyiIUKghlEwhV8NpC7WUnBEnKGHMs8KM9ia7HYenczKRfpzizbVZPp4T7jv2Rqp/R81iwZ7J6u5pHlwLav7dr5Qlwd4MX7J50+pplReBFzHayYf0yjXUZF2jM2MNhkDS9QO2CSL5wDKEKHHGKmNAieOtJ5Ftfl4iuFYJzFe3u8Onnr1aV4LnNq0pvqDxDgKR97buL2eZqW50vdw3N1cGa2Lva2i4c8pa6DbfUUH07/Zc+zIijQI/QuE7A5q2PbDk5i9j4jQNUOsm2Sg5C/mw8ttKq1RrSnDa1elljZ9q780J+sgrGrzucSltEjwLKpS4AFeA51u+YPPtXP6C1t+NNJobZN0mFo46pUGpzXPFwe/PFZnrIRd0mnQdA63gE0hnmSJtD062BvPf/5E1TUe73zkMiEYFjZ7TEwWQFPzjXaVUg4LaXzea2UJU1QssqUglg7gUXs4esn8v27lCGAFwkNUOMpiUxKE17RfO5nsRwdsffhKPTflp5TXH/tsCNWsBTmXOVTigExgjORUgx7BSsGR1pXFHdJemb7nQvtFALpvyL/3jJPZ+tkW2OCFe+4qzNDS6urwLNbIfO7G4O4EjAiQd+GcU0FwjVXknm6aESwyrw== X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(376002)(39860400002)(346002)(396003)(136003)(46966006)(36840700001)(26005)(5660300002)(426003)(70586007)(70206006)(8676002)(7636003)(2616005)(356005)(186003)(7696005)(82310400003)(82740400003)(36756003)(2906002)(9786002)(478600001)(44832011)(316002)(8936002)(36906005)(6916009)(336012)(54906003)(966005)(83380400001)(66574015)(47076005)(36860700001)(107886003)(4326008)(6666004)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 04:50:05.9341 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4792213b-f466-46c2-2630-08d8d3c8a94d X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT010.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5941 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Add clocking wizard driver to clk. And delete the driver from the staging as it is in drivers/clk. Signed-off-by: Shubhrajyoti Datta --- v7: Combined the patch for deletion and add of the driver dropping the ack from Greg for the staging as it is a combined patch. Add vendor prefix to speedgrade v8: No change v9: No change drivers/clk/Kconfig | 9 +++++++ drivers/clk/Makefile | 1 + .../clk-xlnx-clock-wizard.c | 6 +++-- drivers/staging/Kconfig | 2 -- drivers/staging/Makefile | 1 - drivers/staging/clocking-wizard/Kconfig | 10 -------- drivers/staging/clocking-wizard/Makefile | 2 -- drivers/staging/clocking-wizard/TODO | 12 --------- drivers/staging/clocking-wizard/dt-binding.txt | 30 ---------------------- 9 files changed, 14 insertions(+), 59 deletions(-) rename drivers/{staging/clocking-wizard => clk}/clk-xlnx-clock-wizard.c (98%) delete mode 100644 drivers/staging/clocking-wizard/Kconfig delete mode 100644 drivers/staging/clocking-wizard/Makefile delete mode 100644 drivers/staging/clocking-wizard/TODO delete mode 100644 drivers/staging/clocking-wizard/dt-binding.txt diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index c715d46..d210ed2 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -359,6 +359,15 @@ config COMMON_CLK_FIXED_MMIO help Support for Memory Mapped IO Fixed clocks +config COMMON_CLK_XLNX_CLKWZRD + tristate "Xilinx Clocking Wizard" + depends on COMMON_CLK && OF + help + Support for the Xilinx Clocking Wizard IP core clock generator. + Adds support for clocking wizard and compatible. + This driver supports the Xilinx clocking wizard programmable clock + synthesizer. The number of output is configurable in the design. + source "drivers/clk/actions/Kconfig" source "drivers/clk/analogbits/Kconfig" source "drivers/clk/baikal-t1/Kconfig" diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index da8fcf1..1ad6414 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -69,6 +69,7 @@ obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o obj-$(CONFIG_COMMON_CLK_VC5) += clk-versaclock5.o obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o +obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clk-xlnx-clock-wizard.o # please keep this section sorted lexicographically by directory path name obj-y += actions/ diff --git a/drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c b/drivers/clk/clk-xlnx-clock-wizard.c similarity index 98% rename from drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c rename to drivers/clk/clk-xlnx-clock-wizard.c index e52a64b..1bab68e 100644 --- a/drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c +++ b/drivers/clk/clk-xlnx-clock-wizard.c @@ -2,9 +2,11 @@ /* * Xilinx 'Clocking Wizard' driver * - * Copyright (C) 2013 - 2014 Xilinx + * Copyright (C) 2013 - 2020 Xilinx * * Sören Brinkmann + * Shubhrajyoti Datta + * */ #include @@ -146,7 +148,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) if (IS_ERR(clk_wzrd->base)) return PTR_ERR(clk_wzrd->base); - ret = of_property_read_u32(np, "speed-grade", &clk_wzrd->speed_grade); + ret = of_property_read_u32(np, "xlnx,speed-grade", &clk_wzrd->speed_grade); if (!ret) { if (clk_wzrd->speed_grade < 1 || clk_wzrd->speed_grade > 3) { dev_warn(&pdev->dev, "invalid speed grade '%d'\n", diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 2d03104..38a9287 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -76,8 +76,6 @@ source "drivers/staging/gs_fpgaboot/Kconfig" source "drivers/staging/unisys/Kconfig" -source "drivers/staging/clocking-wizard/Kconfig" - source "drivers/staging/fbtft/Kconfig" source "drivers/staging/fsl-dpaa2/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 757a892..58bceb8 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -28,7 +28,6 @@ obj-$(CONFIG_FIREWIRE_SERIAL) += fwserial/ obj-$(CONFIG_GOLDFISH) += goldfish/ obj-$(CONFIG_GS_FPGABOOT) += gs_fpgaboot/ obj-$(CONFIG_UNISYSSPAR) += unisys/ -obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/ obj-$(CONFIG_FB_TFT) += fbtft/ obj-$(CONFIG_FSL_DPAA2) += fsl-dpaa2/ obj-$(CONFIG_MOST) += most/ diff --git a/drivers/staging/clocking-wizard/Kconfig b/drivers/staging/clocking-wizard/Kconfig deleted file mode 100644 index 69cf514..0000000 --- a/drivers/staging/clocking-wizard/Kconfig +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Xilinx Clocking Wizard Driver -# - -config COMMON_CLK_XLNX_CLKWZRD - tristate "Xilinx Clocking Wizard" - depends on COMMON_CLK && OF && IOMEM - help - Support for the Xilinx Clocking Wizard IP core clock generator. diff --git a/drivers/staging/clocking-wizard/Makefile b/drivers/staging/clocking-wizard/Makefile deleted file mode 100644 index b1f9152..0000000 --- a/drivers/staging/clocking-wizard/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clk-xlnx-clock-wizard.o diff --git a/drivers/staging/clocking-wizard/TODO b/drivers/staging/clocking-wizard/TODO deleted file mode 100644 index ebe99db..0000000 --- a/drivers/staging/clocking-wizard/TODO +++ /dev/null @@ -1,12 +0,0 @@ -TODO: - - support for fractional multiplier - - support for fractional divider (output 0 only) - - support for set_rate() operations (may benefit from Stephen Boyd's - refactoring of the clk primitives: https://lkml.org/lkml/2014/9/5/766) - - review arithmetic - - overflow after multiplication? - - maximize accuracy before divisions - -Patches to: - Greg Kroah-Hartman - Sören Brinkmann diff --git a/drivers/staging/clocking-wizard/dt-binding.txt b/drivers/staging/clocking-wizard/dt-binding.txt deleted file mode 100644 index efb67ff..0000000 --- a/drivers/staging/clocking-wizard/dt-binding.txt +++ /dev/null @@ -1,30 +0,0 @@ -Binding for Xilinx Clocking Wizard IP Core - -This binding uses the common clock binding[1]. Details about the devices can be -found in the product guide[2]. - -[1] Documentation/devicetree/bindings/clock/clock-bindings.txt -[2] Clocking Wizard Product Guide -https://www.xilinx.com/support/documentation/ip_documentation/clk_wiz/v5_1/pg065-clk-wiz.pdf - -Required properties: - - compatible: Must be 'xlnx,clocking-wizard' - - reg: Base and size of the cores register space - - clocks: Handle to input clock - - clock-names: Tuple containing 'clk_in1' and 's_axi_aclk' - - clock-output-names: Names for the output clocks - -Optional properties: - - speed-grade: Speed grade of the device (valid values are 1..3) - -Example: - clock-generator@40040000 { - reg = <0x40040000 0x1000>; - compatible = "xlnx,clocking-wizard"; - speed-grade = <1>; - clock-names = "clk_in1", "s_axi_aclk"; - clocks = <&clkc 15>, <&clkc 15>; - clock-output-names = "clk_out0", "clk_out1", "clk_out2", - "clk_out3", "clk_out4", "clk_out5", - "clk_out6", "clk_out7"; - }; From patchwork Thu Feb 18 04:49:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 12093039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA9B0C433DB for ; Thu, 18 Feb 2021 04:51:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91B4064EAF for ; Thu, 18 Feb 2021 04:51:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230290AbhBREvF (ORCPT ); Wed, 17 Feb 2021 23:51:05 -0500 Received: from mail-co1nam11on2062.outbound.protection.outlook.com ([40.107.220.62]:1249 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230233AbhBREvE (ORCPT ); Wed, 17 Feb 2021 23:51:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iYe4FfYc/V5AtNWUjB+WxAGdLRPv/kjpNcOTlgjrdpIm5ZCBKOVy53MESlCxjh09J7+B0tZFDoxNHDC0KxWlQZ6ao4mRlgA3OymITUnv0+KzKsV3bxyZxka/9zdfyVOdpMlFS005hW4NikDGYaKSCWj/TPELCRC9Ec1zL9noSMQXvX94WBbFJDq2HMMM4RrvOpKUdEY4jE+3gtIJFaqyVWP8mp4Ag9mNLYZU8yq1gOcN2i51VEHVOMDWILc69h8u+Djiw8gtVX4/AcC1w8we9b4oZZs/f27KSqc+MljoCflRuC8q+fkPmdl+O4zZrDNSIjyl3kNk7h+/UuGN7EgWsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CVuuTVm4kNVjw1QohjTJFApSIi3tzsnwlDaYpbM359E=; b=HMQ6wjJgwh9AA8XNIeMb5iOt0/bDDul7LB08+xWQFOyFajOKz0yfGbGGLpuf1jnVMY2rWry/djFvdA1rCitYPm/EGWtwtE7Ti9KiWVW3Mz2L6l3q3iM5Eb22ukB2SWRz52nEPADYVTEgTWy2w3HcQIC1pYQ4NyDwoRgXdoLCieNgrFNdV6qQVVqyz+TySjHjXrcqMMiA2ISY3bSc9RnaJJdg83jomEKLAymnqWU6PI/YGwVcBm9dEsMNmbeIWDAPc/5+18It3pLFknrushtmBI0IOYgUET/7RRyZE2mAl3ovDC5dYyi0FOoTqMZGnqYfejUHahF4GiGiYmx6nbkaag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CVuuTVm4kNVjw1QohjTJFApSIi3tzsnwlDaYpbM359E=; b=noPlIdLVi6u3tFssk1MG0yP7eU0glK+cTj92NQIUkpSJ1RzxZpi+IMXSybp3Uy6RU6jDFM8jfYN1FiIUczJdISuLRwlKXoSKHng9XhPF0By96FNkFPr5o8bRpZexCkP2QQ2Pjx7Ddn+8qN0V7s/PEfgrHNSjSN/Cd7Y5FOCTf6k= Received: from DM6PR02CA0123.namprd02.prod.outlook.com (2603:10b6:5:1b4::25) by DM6PR02MB5641.namprd02.prod.outlook.com (2603:10b6:5:77::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Thu, 18 Feb 2021 04:50:12 +0000 Received: from DM3NAM02FT047.eop-nam02.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::9f) by DM6PR02CA0123.outlook.office365.com (2603:10b6:5:1b4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT047.mail.protection.outlook.com (10.13.4.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:12 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Wed, 17 Feb 2021 20:50:05 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Wed, 17 Feb 2021 20:50:05 -0800 Envelope-to: shubhrajyoti.datta@xilinx.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, mturquette@baylibre.com, sboyd@kernel.org, gregkh@linuxfoundation.org, shubhrajyoti.datta@gmail.com, miquel.raynal@bootlin.com Received: from [10.140.6.59] (port=35054 helo=xhdshubhraj40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lCbGP-0004qG-8Y; Wed, 17 Feb 2021 20:50:05 -0800 From: Shubhrajyoti Datta To: CC: , , , , , , "Shubhrajyoti Datta" Subject: [PATCH v9 3/7] clk: clock-wizard: Fix kernel-doc warning Date: Thu, 18 Feb 2021 10:19:47 +0530 Message-ID: <1613623791-4598-4-git-send-email-shubhrajyoti.datta@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> References: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3c119e4e-00f3-4a83-a88b-08d8d3c8acea X-MS-TrafficTypeDiagnostic: DM6PR02MB5641: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TKIK7U28MzcpAbFkrP52yLrn94Tkl34A+O0dhGStQAFFwiDAVFXyk22T7hcsCwfzas9r/BgkJyFnC6Uj+dvbmc/lfgk3u34Yrx3YRgRBPDLNdu3sPwtTKMSf0Kpg6TEHDrPvj2KQABkr7EeltGVyh+1+p88InJd3Km8ZI/yTvuEGGetNFcI6+PD2IdgbC4rYA1FknMBCOiEvqQNgXMSnOk7sREVmciRNuNZiPT9b8Yoq0C3QYlwoqFKVKnOLZS9qVGahJEtXqvvGN8V1szaXWGgSom5rZSWGRrGfum0mvINCz685v6d9xsIiWueJUYk5jC00qE5Ic8g5r5Ke5sBqfpfo3Mlfn/O4JZvMxst1n7uUkN/CP0kckg1R11fKwVD2tsMJu7cCX4SahN0FYkZSslO8V4hzf6Eqo2K9aH0FarO9t3rwtDNHaaosqBL+TlTjDK7HM9O6fmj+oqMLbnoR9bX+lG2jLbr/VrtX0h+Ol7LnaR16b1uasQjA0p6GktrPoJLQry4uf+Sd6w/cxT6APxC++GNtCGmcoPvQJ8KBCdBSuohlAHP3C/pe7pWraSUyMis10Gnk2ezcKL0+FVwmRYfPxKrL2N+QNbwqqg5t9Mj0Cr+z7xcvdUElqF4eCposZ2DGXFkc65HKXvSdX9uuJl5cMDU62QIFh0Qm+zR5JuARQLVI2lbBykB1o9qCmYLZ X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(396003)(346002)(376002)(136003)(39860400002)(36840700001)(46966006)(356005)(316002)(9786002)(4744005)(2616005)(7696005)(6666004)(426003)(336012)(186003)(26005)(70206006)(54906003)(47076005)(70586007)(44832011)(4326008)(2906002)(107886003)(36906005)(8676002)(83380400001)(36756003)(36860700001)(82310400003)(478600001)(82740400003)(8936002)(6916009)(5660300002)(7636003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 04:50:12.0005 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3c119e4e-00f3-4a83-a88b-08d8d3c8acea X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT047.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5641 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Update description for the clocking wizard structure Signed-off-by: Shubhrajyoti Datta --- drivers/clk/clk-xlnx-clock-wizard.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-xlnx-clock-wizard.c b/drivers/clk/clk-xlnx-clock-wizard.c index 1bab68e..fb2d555 100644 --- a/drivers/clk/clk-xlnx-clock-wizard.c +++ b/drivers/clk/clk-xlnx-clock-wizard.c @@ -40,7 +40,8 @@ enum clk_wzrd_int_clks { }; /** - * struct clk_wzrd: + * struct clk_wzrd - Clock wizard private data structure + * * @clk_data: Clock data * @nb: Notifier block * @base: Memory base From patchwork Thu Feb 18 04:49:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 12093041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84062C433E0 for ; Thu, 18 Feb 2021 04:51:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D18560C3D for ; Thu, 18 Feb 2021 04:51:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230299AbhBREvQ (ORCPT ); Wed, 17 Feb 2021 23:51:16 -0500 Received: from mail-bn8nam12on2049.outbound.protection.outlook.com ([40.107.237.49]:32033 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230233AbhBREvN (ORCPT ); Wed, 17 Feb 2021 23:51:13 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mdqzYmh3A3rZsR61XNaO3VqOOZoZTUyMXy0uUIMmb/YHFYDwkx3XnnZnPuhKxQZRHpbdXgOpMgqlJ9IdITtjuqjCD5TtJRyKB4M6D+J8ymtHuf0w1Mfpcx4tNWPnLZA3U6gK1wCgwET5dPWN9JPJwwF7iQIO4KGnXk8P4T6c4tPA1fyk7+oh3Gphik0OyZTiA/7/NQKN2OeKkJJSUPzIdLTRuu5MH1xa/iKiLSgNCD+XoIgY68WKLGrS26OC4FJRSI48vMzHXa3YwqbDjohUwYt/KH8Jg1LMnpMqWVS7KuwlTJjshWi+hAd52wONx2txrdggqFmwQ9CcjU8KJdfHog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3vfq0GVycpTs1+KvU5P5xIWU+3WTFUs0I2USFq3kzj4=; b=R9SFTxyS9e61Vz4NRPP/8b6YCTBP3n7VXC4jwL7CVc56JkTLTMI2kF6FcEGyPLatK8D1rR57L9AzwjjRR1uDT8VVXvMSOPw/qJ1j0hNRFI8dWaVF27yIWnKK9XD3lbH/qnvqeDqu+uYmzCDyYMKmFnFQ+aav08rPonVg4ISt/NISdVmjdXZYVtTfF2bWUPsdo836huRL3Kxm3j+vJX7DkHL7VmMSDSdnQ4FfjbBhE0KuwGo6qxaD/mu5zbeFfN2EWwKJc5gNXl+OqnEKuKwPXJIoccSo33PznD5zJ+yuLSGC5cv42mup2yJQRKtQ3Q7nO5ouCiPkQLEU5TgWmggyEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3vfq0GVycpTs1+KvU5P5xIWU+3WTFUs0I2USFq3kzj4=; b=qsZU8752jIx07a7QnqqulEG/UCjgYi05EDHSyU26hUoMzviNmUcV/AMl3qndJxUWbi3IA5vJ/ltIwoUTxnaIz3FB51MJxA/Qh3FbOVr9vccZf00ZP7WmM7brjw30tkEyFlkaPgVrWnN1q9B942M++E5h9kdWOe3o9SN6/b70mCc= Received: from DM6PR02CA0127.namprd02.prod.outlook.com (2603:10b6:5:1b4::29) by PH0PR02MB7349.namprd02.prod.outlook.com (2603:10b6:510:1d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Thu, 18 Feb 2021 04:50:19 +0000 Received: from DM3NAM02FT047.eop-nam02.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::57) by DM6PR02CA0127.outlook.office365.com (2603:10b6:5:1b4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT047.mail.protection.outlook.com (10.13.4.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:18 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Wed, 17 Feb 2021 20:50:12 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Wed, 17 Feb 2021 20:50:12 -0800 Envelope-to: shubhrajyoti.datta@xilinx.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, mturquette@baylibre.com, sboyd@kernel.org, gregkh@linuxfoundation.org, shubhrajyoti.datta@gmail.com, miquel.raynal@bootlin.com Received: from [10.140.6.59] (port=35054 helo=xhdshubhraj40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lCbGV-0004qG-V1; Wed, 17 Feb 2021 20:50:12 -0800 From: Shubhrajyoti Datta To: CC: , , , , , , "Shubhrajyoti Datta" , Chirag Parekh Subject: [PATCH v9 4/7] clk: clock-wizard: Add support for dynamic reconfiguration Date: Thu, 18 Feb 2021 10:19:48 +0530 Message-ID: <1613623791-4598-5-git-send-email-shubhrajyoti.datta@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> References: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d5e21265-2821-474f-9d6c-08d8d3c8b114 X-MS-TrafficTypeDiagnostic: PH0PR02MB7349: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:1201; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ch7ztiUuSO+i0qozcqZWHoRaeWP3fpEYVAd7XTUn/6kcFUupaKoYWlH1+Dyw/2XYrhxIvxHg3C9HmECk2KD1qPn55hwrHdCNTA5h2Aw6y2H25hevq+qaL63hWWknWaJxBYegeUALaFpZgwK3jPDY6Hg1XftqPfXTAA4d9Dsr0AB3xzszHquiEY+12oWUCrmLWTWtcCuDmq1RMJ6yJT+ppBP/0gREgWGGTOfUw1MBJYN6PyUDtYuLKlXkcG+pUUUbqxuV5yf3TH8D/QqquUi2Ts3LStgmTkx1T3YAUapNqaVljPyLwE2m7StnL8pMz3MjtASi2/E5dNa494eIZmm8xF7xHQ/i1I3NIZ18MRl3rLlDwy/AHIVz1V2rvdxzZF4HhT1RIWJo0YQNIgROZExOqqQTzlyDRm2e0phrfeYCEy1b4iL1HzldlLbYvh8NqIpxzwGV0hgkH8zdM3niHncMSWeH+/JJOHrbii26TwvBM98bC77Z5usAW2Gek6fncZdUNjE1/QFBTsKJZG0BDMM3OE71ESFOHVp0+b4oGoVgnj/tVkDWXW42EKGOCk3K7xfGY5ixZ2fLteqkX5uY8Y5qS6ZF8nv9N+d19a59f9RTK6YGNpmlqQ9YSQprN5+SJbxfqhtC85FHuu0nc5nwXVOR1K61MPwxPWeOyEmRmU6anG1c32Oe1YU7BLWoizQbitIs X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(39860400002)(376002)(396003)(346002)(136003)(36840700001)(46966006)(83380400001)(54906003)(107886003)(426003)(36756003)(36860700001)(5660300002)(70206006)(336012)(70586007)(26005)(4326008)(6916009)(2906002)(44832011)(2616005)(316002)(9786002)(8936002)(186003)(356005)(47076005)(7696005)(478600001)(7636003)(6666004)(8676002)(82310400003)(82740400003)(36906005)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 04:50:18.9873 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d5e21265-2821-474f-9d6c-08d8d3c8b114 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT047.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7349 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org The patch adds support for dynamic reconfiguration of clock output rate. Output clocks are registered as dividers and set rate callback function is used for dynamic reconfiguration. Based on the initial work from Chirag. Signed-off-by: Chirag Parekh Signed-off-by: Shubhrajyoti Datta --- v6: Remove the typecast. use min for capping frequency. use polled timeout v7: Use devm functions Add the spinlock drivers/clk/clk-xlnx-clock-wizard.c | 181 ++++++++++++++++++++++++++++++++++-- 1 file changed, 175 insertions(+), 6 deletions(-) diff --git a/drivers/clk/clk-xlnx-clock-wizard.c b/drivers/clk/clk-xlnx-clock-wizard.c index fb2d555..5581b24 100644 --- a/drivers/clk/clk-xlnx-clock-wizard.c +++ b/drivers/clk/clk-xlnx-clock-wizard.c @@ -17,6 +17,7 @@ #include #include #include +#include #define WZRD_NUM_OUTPUTS 7 #define WZRD_ACLK_MAX_FREQ 250000000UL @@ -31,8 +32,23 @@ #define WZRD_DIVCLK_DIVIDE_SHIFT 0 #define WZRD_DIVCLK_DIVIDE_MASK (0xff << WZRD_DIVCLK_DIVIDE_SHIFT) #define WZRD_CLKOUT_DIVIDE_SHIFT 0 +#define WZRD_CLKOUT_DIVIDE_WIDTH 8 #define WZRD_CLKOUT_DIVIDE_MASK (0xff << WZRD_DIVCLK_DIVIDE_SHIFT) +#define WZRD_DR_MAX_INT_DIV_VALUE 255 +#define WZRD_DR_NUM_RETRIES 10000 +#define WZRD_DR_STATUS_REG_OFFSET 0x04 +#define WZRD_DR_LOCK_BIT_MASK 0x00000001 +#define WZRD_DR_INIT_REG_OFFSET 0x25C +#define WZRD_DR_DIV_TO_PHASE_OFFSET 4 +#define WZRD_DR_BEGIN_DYNA_RECONF 0x03 + +/* Get the mask from width */ +#define div_mask(width) ((1 << (width)) - 1) + +/* Extract divider instance from clock hardware instance */ +#define to_clk_wzrd_divider(_hw) container_of(_hw, struct clk_wzrd_divider, hw) + enum clk_wzrd_int_clks { wzrd_clk_mul, wzrd_clk_mul_div, @@ -64,6 +80,29 @@ struct clk_wzrd { bool suspended; }; +/** + * struct clk_wzrd_divider - clock divider specific to clk_wzrd + * + * @hw: handle between common and hardware-specific interfaces + * @base: base address of register containing the divider + * @offset: offset address of register containing the divider + * @shift: shift to the divider bit field + * @width: width of the divider bit field + * @flags: clk_wzrd divider flags + * @table: array of value/divider pairs, last entry should have div = 0 + * @lock: register lock + */ +struct clk_wzrd_divider { + struct clk_hw hw; + void __iomem *base; + u16 offset; + u8 shift; + u8 width; + u8 flags; + const struct clk_div_table *table; + spinlock_t *lock; /* divider lock */ +}; + #define to_clk_wzrd(_nb) container_of(_nb, struct clk_wzrd, nb) /* maximum frequencies for input/output clocks per speed grade */ @@ -73,6 +112,132 @@ static const unsigned long clk_wzrd_max_freq[] = { 1066000000UL }; +/* spin lock variable for clk_wzrd */ +static DEFINE_SPINLOCK(clkwzrd_lock); + +static unsigned long clk_wzrd_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw); + void __iomem *div_addr = divider->base + divider->offset; + unsigned int val; + + val = readl(div_addr) >> divider->shift; + val &= div_mask(divider->width); + + return divider_recalc_rate(hw, parent_rate, val, divider->table, + divider->flags, divider->width); +} + +static int clk_wzrd_dynamic_reconfig(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) +{ + int err = 0; + u32 value; + unsigned long flags = 0; + struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw); + void __iomem *div_addr = divider->base + divider->offset; + + if (divider->lock) + spin_lock_irqsave(divider->lock, flags); + else + __acquire(divider->lock); + + value = DIV_ROUND_CLOSEST(parent_rate, rate); + + /* Cap the value to max */ + min_t(u32, value, WZRD_DR_MAX_INT_DIV_VALUE); + + /* Set divisor and clear phase offset */ + writel(value, div_addr); + writel(0x00, div_addr + WZRD_DR_DIV_TO_PHASE_OFFSET); + + /* Check status register */ + err = readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET, + value, value & WZRD_DR_LOCK_BIT_MASK, + WZRD_USEC_POLL, WZRD_TIMEOUT_POLL); + if (err) + goto err_reconfig; + + /* Initiate reconfiguration */ + writel(WZRD_DR_BEGIN_DYNA_RECONF, + divider->base + WZRD_DR_INIT_REG_OFFSET); + + /* Check status register */ + err = readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET, + value, value & WZRD_DR_LOCK_BIT_MASK, + WZRD_USEC_POLL, WZRD_TIMEOUT_POLL); +err_reconfig: + if (divider->lock) + spin_unlock_irqrestore(divider->lock, flags); + else + __release(divider->lock); + return err; +} + +static long clk_wzrd_round_rate(struct clk_hw *hw, unsigned long rate, + unsigned long *prate) +{ + u8 div; + + /* + * since we don't change parent rate we just round rate to closest + * achievable + */ + div = DIV_ROUND_CLOSEST(*prate, rate); + + return (*prate / div); +} + +static const struct clk_ops clk_wzrd_clk_divider_ops = { + .round_rate = clk_wzrd_round_rate, + .set_rate = clk_wzrd_dynamic_reconfig, + .recalc_rate = clk_wzrd_recalc_rate, +}; + +static struct clk *clk_wzrd_register_divider(struct device *dev, + const char *name, + const char *parent_name, + unsigned long flags, + void __iomem *base, u16 offset, + u8 shift, u8 width, + u8 clk_divider_flags, + const struct clk_div_table *table, + spinlock_t *lock) +{ + struct clk_wzrd_divider *div; + struct clk_hw *hw; + struct clk_init_data init; + int ret; + + div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + if (!div) + return ERR_PTR(-ENOMEM); + + init.name = name; + init.ops = &clk_wzrd_clk_divider_ops; + init.flags = flags; + init.parent_names = &parent_name; + init.num_parents = 1; + + div->base = base; + div->offset = offset; + div->shift = shift; + div->width = width; + div->flags = clk_divider_flags; + div->lock = lock; + div->hw.init = &init; + div->table = table; + + /* register the clock */ + hw = &div->hw; + ret = devm_clk_hw_register(dev, hw); + if (ret) + hw = ERR_PTR(ret); + + return hw->clk; +} + static int clk_wzrd_clk_notifier(struct notifier_block *nb, unsigned long event, void *data) { @@ -223,7 +388,8 @@ static int clk_wzrd_probe(struct platform_device *pdev) clk_wzrd->clks_internal[wzrd_clk_mul_div] = clk_register_fixed_factor (&pdev->dev, clk_name, __clk_get_name(clk_wzrd->clks_internal[wzrd_clk_mul]), - 0, 1, reg); + flags, ctrl_reg, 0, 8, CLK_DIVIDER_ONE_BASED | + CLK_DIVIDER_ALLOW_ZERO, &clkwzrd_lock); if (IS_ERR(clk_wzrd->clks_internal[wzrd_clk_mul_div])) { dev_err(&pdev->dev, "unable to register divider clock\n"); ret = PTR_ERR(clk_wzrd->clks_internal[wzrd_clk_mul_div]); @@ -241,11 +407,14 @@ static int clk_wzrd_probe(struct platform_device *pdev) ret = -EINVAL; goto err_rm_int_clks; } - reg = readl(clk_wzrd->base + WZRD_CLK_CFG_REG(2) + i * 12); - reg &= WZRD_CLKOUT_DIVIDE_MASK; - reg >>= WZRD_CLKOUT_DIVIDE_SHIFT; - clk_wzrd->clkout[i] = clk_register_fixed_factor - (&pdev->dev, clkout_name, clk_name, 0, 1, reg); + clk_wzrd->clkout[i] = clk_wzrd_register_divider(&pdev->dev, + clkout_name, + clk_name, 0, + clk_wzrd->base, (WZRD_CLK_CFG_REG(2) + i * 12), + WZRD_CLKOUT_DIVIDE_SHIFT, + WZRD_CLKOUT_DIVIDE_WIDTH, + CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, + NULL, &clkwzrd_lock); if (IS_ERR(clk_wzrd->clkout[i])) { int j; From patchwork Thu Feb 18 04:49:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 12093043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5F8DC433DB for ; Thu, 18 Feb 2021 04:51:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A441364E79 for ; Thu, 18 Feb 2021 04:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230303AbhBREvS (ORCPT ); Wed, 17 Feb 2021 23:51:18 -0500 Received: from mail-co1nam11on2087.outbound.protection.outlook.com ([40.107.220.87]:22075 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230295AbhBREvR (ORCPT ); Wed, 17 Feb 2021 23:51:17 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xmq5/Qa1ZH1VPEU9bT8vdxm17Lr9yZZSkzRImBg/pxLAThwktVU5jG2quq45xv24cfzZjhjtD62gokRw+EZj3hCyz3gjEPimmHdlXM0dgqjfLAXWBVhyaHC/BP298yjRt7JsFguv3iVs7BM9pp6G8cqFqenlu1uQbLljx2WsKi7oKQcZ2wj9mN5xkvN4hdeNip0Gd+8/ea7gAw0M97xk3k5OyDVqWJANphe+qOvFvc/6/r7eI2ZPua5grO6vstpmHvJgs1yedlKCASfPMZKNxx1el1PsuEsg1MRG27jHFIdat6Ewgtv0K0GIJjfb3jTy1b4TOekDEoqiAUoizfh2OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=piePE8p91gavipu5CJKchcefOGcrwahdkDbeEzaDfxA=; b=HdiXl8Mf2tk0vKRMHn4jlfx28AuTYWYdO+hbJj3yrcUg9Ku3bWjqJx2GlebH2hwxrodpORLZ6udig+tjWkipxaZKFN5DsAnpAsDSH5RG1zdbsyEN0wesneDjstZsqDZRlEFwJbOAHgjhMu+m3tg8TGVnJ2pmMyvSNXVRyHQBJ5HpuhOQF4MPwWadwNQcI2wV2oMK21hsjQdEJqXoOPYAjqZujBw8aOparrUJmpWaGcILazczfW/OroKYRF1Nbr+2w7LpX+djV2T2tmhRlJpuwxRd/THJgq3CuFCz5Q4begxr6Dx+1Q9KOart9kVnyY0SIPW34EfaymHReaFU0t224w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=piePE8p91gavipu5CJKchcefOGcrwahdkDbeEzaDfxA=; b=i/k2+gGgXMfJ55gRuE6c9P2/2/lzX8zlM7B3g7CYVEWhoS7InNi+sd2qoHp2BLZJswpUpKWAGeiI65EikZV7xRX7ZFP1fXekNJToyQ5VhGI2gLUm26Ge/O4ZLJr6rhlqsJePn7XDtzGf37ns111+BjERaWe3onMr2hMHNUuqcFo= Received: from DM6PR02CA0127.namprd02.prod.outlook.com (2603:10b6:5:1b4::29) by BYAPR02MB5047.namprd02.prod.outlook.com (2603:10b6:a03:66::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Thu, 18 Feb 2021 04:50:23 +0000 Received: from DM3NAM02FT047.eop-nam02.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::57) by DM6PR02CA0127.outlook.office365.com (2603:10b6:5:1b4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT047.mail.protection.outlook.com (10.13.4.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:22 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Wed, 17 Feb 2021 20:50:15 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Wed, 17 Feb 2021 20:50:15 -0800 Envelope-to: shubhrajyoti.datta@xilinx.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, mturquette@baylibre.com, sboyd@kernel.org, gregkh@linuxfoundation.org, shubhrajyoti.datta@gmail.com, miquel.raynal@bootlin.com Received: from [10.140.6.59] (port=35054 helo=xhdshubhraj40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lCbGZ-0004qG-44; Wed, 17 Feb 2021 20:50:15 -0800 From: Shubhrajyoti Datta To: CC: , , , , , , "Shubhrajyoti Datta" Subject: [PATCH v9 5/7] clk: clock-wizard: Add support for fractional support Date: Thu, 18 Feb 2021 10:19:49 +0530 Message-ID: <1613623791-4598-6-git-send-email-shubhrajyoti.datta@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> References: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5c0bd574-8dba-4dfb-3231-08d8d3c8b322 X-MS-TrafficTypeDiagnostic: BYAPR02MB5047: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:1186; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g0N5vGbtiYwpy9d0K8U7tYBVcOkPM4adbHg+6KUdTFEjtvGFCaFgcbtduLozifZCJBZ1wKpyBBaZLl+Xa4qSxzOi0c5N6Bk7nelOJ1NU4Z8HEU9QVn8Xth7wGfo6u0356ArINV0siIIq/YDWWFJ+yxKppEhLTmYAeBuJCxWv+WJapkZS9iUeCaZsiEhqBYdX/PmhUoyR3JpSFL1N9aH+c5zdyGy2+84T5+e0O2g75E8MfUPYlAKDxM2oMhUWPijFelvnkyV01EFIC1fP9FdEOuZKj2KMU97bdI5TnaAXMUdFmjSMd5k37tchOX/Cx+zc8vEJNaNAT732rLfsN0KK31rpQ7xMOb7rVQdEgkZ5KXOw9a8vAJmjiJw0Lk2Nk89QBmQGipvtVeR9yXp43KBAwdQ2yKVEJ5HDEtPQx7V7u7P+ZeQS7NSh2H1rLl5gDLlnGrDAd+aSqDjbd6Cb/fSPXE/+ZxNg6J7K30j1UwVo01dywGniaj8NwVEmFnz0s92N9P94GeeMdlfED5tjh1TkvexrxLmdCxOkhL5xasCJ7HBUWEZR4eE/KuDUWKnpvhh0UPdDEDcKb/WdjPxwILriPLJRjeaGnUJAlfmDfVQQZQ3U3UCXJbndUPTuFihCOgz40/+y0dRdoJ8PfSCaYqEzSbHKWgPrisRnMJyeIyjULOUEu/CHe5RQAB7C4qcwV0ir X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(346002)(39860400002)(136003)(376002)(396003)(36840700001)(46966006)(47076005)(9786002)(6916009)(36860700001)(5660300002)(82740400003)(54906003)(83380400001)(70206006)(6666004)(70586007)(26005)(36756003)(336012)(82310400003)(316002)(8936002)(356005)(44832011)(7696005)(36906005)(4326008)(186003)(426003)(8676002)(2906002)(7636003)(2616005)(107886003)(478600001)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 04:50:22.4308 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5c0bd574-8dba-4dfb-3231-08d8d3c8b322 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT047.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5047 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Currently the set rate granularity is to integral divisors. Add support for the fractional divisors. Only the first output0 is fractional in the hardware. Signed-off-by: Shubhrajyoti Datta --- v7: Remove unnecessary comments use mult_frac use a common divisor function. drivers/clk/clk-xlnx-clock-wizard.c | 219 ++++++++++++++++++++++++++++++++---- 1 file changed, 199 insertions(+), 20 deletions(-) diff --git a/drivers/clk/clk-xlnx-clock-wizard.c b/drivers/clk/clk-xlnx-clock-wizard.c index 5581b24..ed3b0ef 100644 --- a/drivers/clk/clk-xlnx-clock-wizard.c +++ b/drivers/clk/clk-xlnx-clock-wizard.c @@ -29,20 +29,25 @@ #define WZRD_CLKFBOUT_MULT_SHIFT 8 #define WZRD_CLKFBOUT_MULT_MASK (0xff << WZRD_CLKFBOUT_MULT_SHIFT) +#define WZRD_CLKFBOUT_FRAC_SHIFT 16 +#define WZRD_CLKFBOUT_FRAC_MASK (0x3ff << WZRD_CLKFBOUT_FRAC_SHIFT) #define WZRD_DIVCLK_DIVIDE_SHIFT 0 #define WZRD_DIVCLK_DIVIDE_MASK (0xff << WZRD_DIVCLK_DIVIDE_SHIFT) #define WZRD_CLKOUT_DIVIDE_SHIFT 0 #define WZRD_CLKOUT_DIVIDE_WIDTH 8 #define WZRD_CLKOUT_DIVIDE_MASK (0xff << WZRD_DIVCLK_DIVIDE_SHIFT) +#define WZRD_CLKOUT_FRAC_SHIFT 8 +#define WZRD_CLKOUT_FRAC_MASK 0x3ff #define WZRD_DR_MAX_INT_DIV_VALUE 255 -#define WZRD_DR_NUM_RETRIES 10000 #define WZRD_DR_STATUS_REG_OFFSET 0x04 #define WZRD_DR_LOCK_BIT_MASK 0x00000001 #define WZRD_DR_INIT_REG_OFFSET 0x25C #define WZRD_DR_DIV_TO_PHASE_OFFSET 4 #define WZRD_DR_BEGIN_DYNA_RECONF 0x03 +#define WZRD_USEC_POLL 10 +#define WZRD_TIMEOUT_POLL 1000 /* Get the mask from width */ #define div_mask(width) ((1 << (width)) - 1) @@ -52,6 +57,7 @@ enum clk_wzrd_int_clks { wzrd_clk_mul, wzrd_clk_mul_div, + wzrd_clk_mul_frac, wzrd_clk_int_max }; @@ -186,7 +192,7 @@ static long clk_wzrd_round_rate(struct clk_hw *hw, unsigned long rate, */ div = DIV_ROUND_CLOSEST(*prate, rate); - return (*prate / div); + return *prate / div; } static const struct clk_ops clk_wzrd_clk_divider_ops = { @@ -195,6 +201,117 @@ static const struct clk_ops clk_wzrd_clk_divider_ops = { .recalc_rate = clk_wzrd_recalc_rate, }; +static unsigned long clk_wzrd_recalc_ratef(struct clk_hw *hw, + unsigned long parent_rate) +{ + unsigned int val; + u32 div, frac; + struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw); + void __iomem *div_addr = divider->base + divider->offset; + + val = readl(div_addr); + div = val & div_mask(divider->width); + frac = (val >> WZRD_CLKOUT_FRAC_SHIFT) & WZRD_CLKOUT_FRAC_MASK; + + return mult_frac(parent_rate, 1000, (div * 1000) + frac); +} + +static int clk_wzrd_dynamic_reconfig_f(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) +{ + int err; + u32 value, pre; + unsigned long rate_div, f, clockout0_div; + struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw); + void __iomem *div_addr = divider->base + divider->offset; + + rate_div = ((parent_rate * 1000) / rate); + clockout0_div = rate_div / 1000; + + pre = DIV_ROUND_CLOSEST((parent_rate * 1000), rate); + f = (u32)(pre - (clockout0_div * 1000)); + f = f & WZRD_CLKOUT_FRAC_MASK; + f = f << WZRD_CLKOUT_DIVIDE_WIDTH; + + value = (f | (clockout0_div & WZRD_CLKOUT_DIVIDE_MASK)); + + /* Set divisor and clear phase offset */ + writel(value, div_addr); + writel(0x0, div_addr + WZRD_DR_DIV_TO_PHASE_OFFSET); + + /* Check status register */ + err = readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET, value, + value & WZRD_DR_LOCK_BIT_MASK, + WZRD_USEC_POLL, WZRD_TIMEOUT_POLL); + if (err) + return err; + + /* Initiate reconfiguration */ + writel(WZRD_DR_BEGIN_DYNA_RECONF, + divider->base + WZRD_DR_INIT_REG_OFFSET); + + /* Check status register */ + return readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET, value, + value & WZRD_DR_LOCK_BIT_MASK, + WZRD_USEC_POLL, WZRD_TIMEOUT_POLL); +} + +static long clk_wzrd_round_rate_f(struct clk_hw *hw, unsigned long rate, + unsigned long *prate) +{ + return rate; +} + +static const struct clk_ops clk_wzrd_clk_divider_ops_f = { + .round_rate = clk_wzrd_round_rate_f, + .set_rate = clk_wzrd_dynamic_reconfig_f, + .recalc_rate = clk_wzrd_recalc_ratef, +}; + +static struct clk *clk_wzrd_register_divf(struct device *dev, + const char *name, + const char *parent_name, + unsigned long flags, + void __iomem *base, u16 offset, + u8 shift, u8 width, + u8 clk_divider_flags, + const struct clk_div_table *table, + spinlock_t *lock) +{ + struct clk_wzrd_divider *div; + struct clk_hw *hw; + struct clk_init_data init; + int ret; + + div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); + if (!div) + return ERR_PTR(-ENOMEM); + + init.name = name; + + init.ops = &clk_wzrd_clk_divider_ops_f; + + init.flags = flags; + init.parent_names = &parent_name; + init.num_parents = 1; + + div->base = base; + div->offset = offset; + div->shift = shift; + div->width = width; + div->flags = clk_divider_flags; + div->lock = lock; + div->hw.init = &init; + div->table = table; + + hw = &div->hw; + ret = devm_clk_hw_register(dev, hw); + if (ret) + return ERR_PTR(ret); + + return hw->clk; +} + static struct clk *clk_wzrd_register_divider(struct device *dev, const char *name, const char *parent_name, @@ -229,7 +346,6 @@ static struct clk *clk_wzrd_register_divider(struct device *dev, div->hw.init = &init; div->table = table; - /* register the clock */ hw = &div->hw; ret = devm_clk_hw_register(dev, hw); if (ret) @@ -237,7 +353,6 @@ static struct clk *clk_wzrd_register_divider(struct device *dev, return hw->clk; } - static int clk_wzrd_clk_notifier(struct notifier_block *nb, unsigned long event, void *data) { @@ -267,6 +382,61 @@ static int clk_wzrd_clk_notifier(struct notifier_block *nb, unsigned long event, } } +static int clk_wzrd_register_dividers(struct platform_device *pdev, + const char *clk_name) +{ + int i, ret; + struct device_node *np = pdev->dev.of_node; + int outputs; + unsigned long flags = 0; + struct clk_wzrd *clk_wzrd = platform_get_drvdata(pdev); + const char *clkout_name; + + outputs = of_property_count_strings(np, "clock-output-names"); + if (outputs == 1) + flags = CLK_SET_RATE_PARENT; + + for (i = outputs - 1; i >= 0 ; i--) { + if (of_property_read_string_index(np, "clock-output-names", i, + &clkout_name)) { + dev_err(&pdev->dev, + "clock output name not specified\n"); + ret = -EINVAL; + return ret; + } + + if (!i) + clk_wzrd->clkout[i] = clk_wzrd_register_divf + (&pdev->dev, clkout_name, + clk_name, flags, + clk_wzrd->base, (WZRD_CLK_CFG_REG(2) + i * 12), + WZRD_CLKOUT_DIVIDE_SHIFT, + WZRD_CLKOUT_DIVIDE_WIDTH, + CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, + NULL, &clkwzrd_lock); + else + clk_wzrd->clkout[i] = clk_wzrd_register_divider + (&pdev->dev, clkout_name, + clk_name, 0, + clk_wzrd->base, (WZRD_CLK_CFG_REG(2) + i * 12), + WZRD_CLKOUT_DIVIDE_SHIFT, + WZRD_CLKOUT_DIVIDE_WIDTH, + CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, + NULL, &clkwzrd_lock); + + if (IS_ERR(clk_wzrd->clkout[i])) { + int j; + + for (j = i + 1; j < outputs; j++) + clk_unregister(clk_wzrd->clkout[j]); + dev_err(&pdev->dev, + "unable to register divider clock\n"); + ret = PTR_ERR(clk_wzrd->clkout[i]); + return ret; + } + } + return 0; +} static int __maybe_unused clk_wzrd_suspend(struct device *dev) { struct clk_wzrd *clk_wzrd = dev_get_drvdata(dev); @@ -298,8 +468,8 @@ static SIMPLE_DEV_PM_OPS(clk_wzrd_dev_pm_ops, clk_wzrd_suspend, static int clk_wzrd_probe(struct platform_device *pdev) { - int i, ret; - u32 reg; + int ret; + u32 reg, reg_f, mult; unsigned long rate; const char *clk_name; struct clk_wzrd *clk_wzrd; @@ -349,17 +519,13 @@ static int clk_wzrd_probe(struct platform_device *pdev) goto err_disable_clk; } - /* we don't support fractional div/mul yet */ - reg = readl(clk_wzrd->base + WZRD_CLK_CFG_REG(0)) & - WZRD_CLKFBOUT_FRAC_EN; - reg |= readl(clk_wzrd->base + WZRD_CLK_CFG_REG(2)) & - WZRD_CLKOUT0_FRAC_EN; - if (reg) - dev_warn(&pdev->dev, "fractional div/mul not supported\n"); + reg = readl(clk_wzrd->base + WZRD_CLK_CFG_REG(0)); + reg_f = reg & WZRD_CLKFBOUT_FRAC_MASK; + reg_f = reg_f >> WZRD_CLKFBOUT_FRAC_SHIFT; - /* register multiplier */ - reg = (readl(clk_wzrd->base + WZRD_CLK_CFG_REG(0)) & - WZRD_CLKFBOUT_MULT_MASK) >> WZRD_CLKFBOUT_MULT_SHIFT; + reg = reg & WZRD_CLKFBOUT_MULT_MASK; + reg = reg >> WZRD_CLKFBOUT_MULT_SHIFT; + mult = (reg * 1000) + reg_f; clk_name = kasprintf(GFP_KERNEL, "%s_mul", dev_name(&pdev->dev)); if (!clk_name) { ret = -ENOMEM; @@ -368,8 +534,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) clk_wzrd->clks_internal[wzrd_clk_mul] = clk_register_fixed_factor (&pdev->dev, clk_name, __clk_get_name(clk_wzrd->clk_in1), - 0, reg, 1); - kfree(clk_name); + 0, mult, 1000); if (IS_ERR(clk_wzrd->clks_internal[wzrd_clk_mul])) { dev_err(&pdev->dev, "unable to register fixed-factor clock\n"); ret = PTR_ERR(clk_wzrd->clks_internal[wzrd_clk_mul]); @@ -407,8 +572,18 @@ static int clk_wzrd_probe(struct platform_device *pdev) ret = -EINVAL; goto err_rm_int_clks; } - clk_wzrd->clkout[i] = clk_wzrd_register_divider(&pdev->dev, - clkout_name, + if (!i) + clk_wzrd->clkout[i] = clk_wzrd_register_divf + (&pdev->dev, clkout_name, + clk_name, 0, + clk_wzrd->base, (WZRD_CLK_CFG_REG(2) + i * 12), + WZRD_CLKOUT_DIVIDE_SHIFT, + WZRD_CLKOUT_DIVIDE_WIDTH, + CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, + NULL, &clkwzrd_lock); + else + clk_wzrd->clkout[i] = clk_wzrd_register_divider + (&pdev->dev, clkout_name, clk_name, 0, clk_wzrd->base, (WZRD_CLK_CFG_REG(2) + i * 12), WZRD_CLKOUT_DIVIDE_SHIFT, @@ -427,6 +602,10 @@ static int clk_wzrd_probe(struct platform_device *pdev) } } + ret = clk_wzrd_register_dividers(pdev, clk_name); + if (ret) + goto err_rm_int_clks; + kfree(clk_name); clk_wzrd->clk_data.clks = clk_wzrd->clkout; From patchwork Thu Feb 18 04:49:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 12093047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A6E2C433E0 for ; Thu, 18 Feb 2021 04:51:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E725F64E79 for ; Thu, 18 Feb 2021 04:51:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230310AbhBREvf (ORCPT ); Wed, 17 Feb 2021 23:51:35 -0500 Received: from mail-mw2nam12on2070.outbound.protection.outlook.com ([40.107.244.70]:56608 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230295AbhBREve (ORCPT ); Wed, 17 Feb 2021 23:51:34 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=muUqzdFLJRcqjCcjA/I18dMZdA/9HZvsOsXmSX2ojPZMJLlnyKbQI2CaKpWwDUouQ3AZBoBnfN661srOTsyLAvKvGQyIB2QbrVbOY1crwLuxmsHr/u6pKcGTWrqPw8IXY0Tnjg2TAgpL8UYWL+hCebaVty/qoK7rp1o9dhnCYSQO0m0+UqIk4NpQizIJy0PsVM/+Q/YVbbPqN1rvueTwNYlI/LzJLTGG1FVoPAkX27IlMBiZr7RdvfQFYeFrNh9lF2NlyXo9tJfCq/9avLDvKync+EtH0hm7FeGWzaGbtZI4eeu8Vwbf10sIfY00TZkPhQHjMVIeTdBZbFwyYZUR8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mPPH057RPQDtOERkZ9ejyiEgSRGlW6mFd0WO963lWKw=; b=fc5+Wpho9lmALTgZwLg4mJalcHnyYt1AMEcrW05hbxv1f52AqbYWfyS+usWMRstXWWk+VrrvMPxCVdKc/GM52r4b7HT20sUE1Kz1ghAivQ1qi634Pc6H/pOAIYXaSfWwo5YIQToucnElZIdkR30EEpqRRb0zta6CWRKHVmPgE+k8+sxoCHzPc65CfHAk5Ohw8L3WI5F7RJZecEPM3pzCRf5YjbiO5HT/esoI7sida+DR8NEo9Xl11MSvpZsT0HtD+IatCxTFiYUR1zs9Ha4HcB4NsGiVU3cFSz65K3S7cu4d28S7KUXVhjo/jhxkxcKwjyJNpkYgw6/fD8r9U59QBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mPPH057RPQDtOERkZ9ejyiEgSRGlW6mFd0WO963lWKw=; b=NvddH7uZb4pHkusSYx6iKtPSTFqmesS2L4bSFk1wDfeTNsniO6QCLvZoxoiQCUTieSq0lhXdwSSN5hr9vPYSXUl6XsgLQmQp6/2QHTFRvGUWLiExOY8iAoeY8BeeocI/dY5IfLPu+c5lD7DX8ReQkR+LiTJC2JleEregEcoFSeU= Received: from DM6PR11CA0026.namprd11.prod.outlook.com (2603:10b6:5:190::39) by MN2PR02MB6432.namprd02.prod.outlook.com (2603:10b6:208:181::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 04:50:40 +0000 Received: from DM3NAM02FT062.eop-nam02.prod.protection.outlook.com (2603:10b6:5:190:cafe::e3) by DM6PR11CA0026.outlook.office365.com (2603:10b6:5:190::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT062.mail.protection.outlook.com (10.13.5.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:40 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Wed, 17 Feb 2021 20:50:19 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Wed, 17 Feb 2021 20:50:19 -0800 Envelope-to: shubhrajyoti.datta@xilinx.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, mturquette@baylibre.com, sboyd@kernel.org, gregkh@linuxfoundation.org, shubhrajyoti.datta@gmail.com, miquel.raynal@bootlin.com Received: from [10.140.6.59] (port=35054 helo=xhdshubhraj40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lCbGc-0004qG-Ob; Wed, 17 Feb 2021 20:50:19 -0800 From: Shubhrajyoti Datta To: CC: , , , , , , "Shubhrajyoti Datta" Subject: [PATCH v9 6/7] clk: clock-wizard: Remove the hardcoding of the clock outputs Date: Thu, 18 Feb 2021 10:19:50 +0530 Message-ID: <1613623791-4598-7-git-send-email-shubhrajyoti.datta@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> References: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 830f1c74-2907-4052-581f-08d8d3c8bda2 X-MS-TrafficTypeDiagnostic: MN2PR02MB6432: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J+XTCSIzrbYi0sBmXnWcOt9pacpmkFBVVaMVeoyy+3rgXSs7Vhb0PsD33dQsHanVurIvU9yUwsXQl6JL1s/Be3n1fkTUBEHtjUGNNLk+rhV840xFwOeajx0gInWrG9+s+HPmrc1VhcsXsEr+b4V0Kx6zHFHqNR4z+syTW/qYUlkFiVt4WGmEJc87RagILFjrfWQQjRbjjZ2Y27bocPsi9f29SIW9lGCFGOneH/Mox5CUDgCBh9wk1lCzVk4QGsDcGq9UeyauLwKNuHAsZu3D867H3SQu8zmA/r2TfFMCXg5fev55voS8efo44w4VK1RFsIcd7OCEHxHmEvohrCVWaJtGY+8ATRI/gOOwk+g0um7tAJmLZ+ZDjaSYxxL39wdE29IFu4iQRejERY1k8fWBsmZqDkaAed1bnZ7Qc7Kf8u0r8ZbqEQt5rT/Bo40O6Il+usOPSPduCNScpsro0CdOhdqdSHB4wyMMAjMwYjZbZ0GJxdglxuo3NOnoPYs0AQD+yJX8ZR20oZvetM8s7OUKryDxg1nX/gx4+wIXuV5iF/HcNOBtqRfHyMFVJNERkS/x0jB205rV4dMz9zjT8amuhthIiHH3XFsBIAI37+0bY8JSMQW0TJE4BB/yr4EqB+JzZcqmuVNhrIzrqgo014Wm9gbDngG/VUf85rqRg1PsPj2qgxJlky1uv7Zkdr6XIzG8 X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(376002)(346002)(396003)(136003)(39860400002)(36840700001)(46966006)(44832011)(7636003)(316002)(8936002)(2616005)(356005)(478600001)(6666004)(8676002)(426003)(82310400003)(82740400003)(54906003)(36860700001)(70586007)(36756003)(5660300002)(7696005)(2906002)(83380400001)(4326008)(186003)(70206006)(9786002)(36906005)(336012)(6916009)(26005)(47076005)(107886003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 04:50:40.0478 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 830f1c74-2907-4052-581f-08d8d3c8bda2 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT062.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6432 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org The number of output clocks are configurable in the hardware. Currently the driver registers the maximum number of outputs. Fix the same by registering only the outputs that are there. Signed-off-by: Shubhrajyoti Datta --- v4: Assign output in this patch drivers/clk/clk-xlnx-clock-wizard.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-xlnx-clock-wizard.c b/drivers/clk/clk-xlnx-clock-wizard.c index ed3b0ef..d403a74 100644 --- a/drivers/clk/clk-xlnx-clock-wizard.c +++ b/drivers/clk/clk-xlnx-clock-wizard.c @@ -473,6 +473,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) unsigned long rate; const char *clk_name; struct clk_wzrd *clk_wzrd; + int outputs; struct device_node *np = pdev->dev.of_node; clk_wzrd = devm_kzalloc(&pdev->dev, sizeof(*clk_wzrd), GFP_KERNEL); @@ -541,6 +542,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) goto err_disable_clk; } + outputs = of_property_count_strings(np, "clock-output-names"); /* register div */ reg = (readl(clk_wzrd->base + WZRD_CLK_CFG_REG(0)) & WZRD_DIVCLK_DIVIDE_MASK) >> WZRD_DIVCLK_DIVIDE_SHIFT; @@ -562,7 +564,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) } /* register div per output */ - for (i = WZRD_NUM_OUTPUTS - 1; i >= 0 ; i--) { + for (i = outputs - 1; i >= 0 ; i--) { const char *clkout_name; if (of_property_read_string_index(np, "clock-output-names", i, @@ -593,7 +595,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) if (IS_ERR(clk_wzrd->clkout[i])) { int j; - for (j = i + 1; j < WZRD_NUM_OUTPUTS; j++) + for (j = i + 1; j < outputs; j++) clk_unregister(clk_wzrd->clkout[j]); dev_err(&pdev->dev, "unable to register divider clock\n"); From patchwork Thu Feb 18 04:49:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 12093045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EFB2C433E0 for ; Thu, 18 Feb 2021 04:51:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5D1B64E7A for ; Thu, 18 Feb 2021 04:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230308AbhBREv3 (ORCPT ); Wed, 17 Feb 2021 23:51:29 -0500 Received: from mail-dm6nam12on2042.outbound.protection.outlook.com ([40.107.243.42]:19040 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230295AbhBREv1 (ORCPT ); Wed, 17 Feb 2021 23:51:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fwDf6a3CX+1TPR9sBqwRJZX5yyilBLfYr8zr73jDditzbhvR5l5wuuqnceuro9XUVzrxRjW0nabZw/luGsWUkDHKUlzKL4CUqKamV85MZXrkZ/EeLrNFGXtuhQO5FdlGiGUWijEO9QCDky+nrJkpD+nk4nDnJ3k3SPQvjClnIodCAYsGOlGdXyUcpHpBjr370WXrvnzxyM5NZJM9mCg6zHGC0HK0fTcr2KfO/V6lXCsBbMfQ865wZostML7IvJhDUkD6qjpBT/tYOonuy955G6LO8fpb1sYnhxnxGkFeshtf5RwuyCmJaQHsKeu4lwFLf1XNu4Q0DbnTlXnn5ESA3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=roEj9Agv1RYOmPCtk4VocZviSZy/fkIAobJzO2mZ+s4=; b=UnO5cBx6q3peVZ2t8JqcwYOmkztfYDTo+IU44oLuEmaj/oa6sTGAvOLRq8dW+OZpxOxtEGaUUH+hETCtwhOgZNqs7ZMb5EspWGhvS2aaejQJunbpHlWe5rr2Lyt2gqKuNiWkci60diwobjiRGBCMLIKAgPTt8XiwY67zGSD86RSe37sBcyKxF8O9Po5ZzzLGkvphUEAmN02BPPXuvisCc20sNAsMqH0t0zMjlHknh6YzwEG5giDM3xaZ1BTgJPBPejGhCGBERD8q+37qEBZpl2eRSZLNHdhrMzHf85es8vxAbguOvGQeTqvhQpwCv6orKYySzPcKPnykNbiGICi9pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=roEj9Agv1RYOmPCtk4VocZviSZy/fkIAobJzO2mZ+s4=; b=Iom/Di3XuzrqR1iyRfhJr1l+73tCTrHE2Iv6XIhPEbiruWqtdu1Drx1ewiGMln47duyFeoPOh/AO1w8WrZMM08NfWI9vrrfwIZL7/2gr7ordNmDD9RbMkMXEaszASKhZmv7vtzdWeFgWrrWchahDkgTpfu0HcJZYkTsQTe9XYgw= Received: from DM5PR04CA0034.namprd04.prod.outlook.com (2603:10b6:3:12b::20) by SJ0PR02MB7343.namprd02.prod.outlook.com (2603:10b6:a03:29c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.31; Thu, 18 Feb 2021 04:50:34 +0000 Received: from DM3NAM02FT016.eop-nam02.prod.protection.outlook.com (2603:10b6:3:12b:cafe::f) by DM5PR04CA0034.outlook.office365.com (2603:10b6:3:12b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT016.mail.protection.outlook.com (10.13.4.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 04:50:33 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Wed, 17 Feb 2021 20:50:21 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Wed, 17 Feb 2021 20:50:21 -0800 Envelope-to: shubhrajyoti.datta@xilinx.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, mturquette@baylibre.com, sboyd@kernel.org, gregkh@linuxfoundation.org, shubhrajyoti.datta@gmail.com, miquel.raynal@bootlin.com Received: from [10.140.6.59] (port=35054 helo=xhdshubhraj40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lCbGf-0004qG-L8; Wed, 17 Feb 2021 20:50:21 -0800 From: Shubhrajyoti Datta To: CC: , , , , , , "Shubhrajyoti Datta" Subject: [PATCH v9 7/7] clk: clock-wizard: Update the fixed factor divisors Date: Thu, 18 Feb 2021 10:19:51 +0530 Message-ID: <1613623791-4598-8-git-send-email-shubhrajyoti.datta@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> References: <1613623791-4598-1-git-send-email-shubhrajyoti.datta@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c2449e6-b176-41e2-33e0-08d8d3c8b9ca X-MS-TrafficTypeDiagnostic: SJ0PR02MB7343: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:989; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9TLe1umxsnuqFP3oIF0DpibFlvzCqf9WSTdSdvnrug4eW77aNTtlsaQLfJDzNl0l4Z/9T05dTNtQvEx15XgKe5tB44qfOxx0rAof3/K6/Eop9fo4o6+bxsTp5m5bNE9N/OP8g45QCVxujqoYOqOjDhKqPsxyk2rbelfn1KQO+O1IHm0AIkl+W2J5gov2BTV6tEjdNjBchN1KM+HrNW1asOmO40c5pUsUOXfpdtC9AcAz7b7vhZkbvQ5+1H35RfDQYxpRRwLMPc3TvodbnzTAqDaT4VPPEYHjGSIBor0XWxOmq58ME6wJ7EmoEVAlqIY5k9SKZ69nUKU5qRh00byPcJIZou5Oaym+NUP2jmfVS4i77z5IbQBGJQFvYc9nz82AvbYVcook0VX06cBc6G2aSyN8IZLrBoWoaKQqCCVOP4u+KVcPiQR0hVhHdN77ojOShupUbWnmYaRWlNVboCCaM3eti47GLbsurnn+AYw8xmOYS9OIJe0Cmpuh5B6pBhDkoVBF7I2Mk+HV46Ub0dgiYvvXsfWgJ8lUNAMvJACX82ZsLvorG1J6hIisG09viTeHtW/FkTp4RVETIAHfYZAWpV5RiJuX2ZiIpvmwAUWkIxYEIv/CPOeI2OdSt60Q/7WRhTQu6T6vfT9EdbGual32J66GZklIkNs35+uQuObiaY9jtj+qiQhj+ghf1ybB0huV X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(346002)(396003)(376002)(136003)(39860400002)(46966006)(36840700001)(44832011)(478600001)(26005)(36906005)(83380400001)(336012)(316002)(2906002)(2616005)(107886003)(15650500001)(186003)(82310400003)(54906003)(6916009)(5660300002)(47076005)(70206006)(82740400003)(8676002)(36860700001)(70586007)(9786002)(7636003)(356005)(4326008)(36756003)(6666004)(426003)(8936002)(7696005)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 04:50:33.5972 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c2449e6-b176-41e2-33e0-08d8d3c8b9ca X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT016.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR02MB7343 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Update the fixed factor clock registration to register the divisors. Signed-off-by: Shubhrajyoti Datta --- drivers/clk/clk-xlnx-clock-wizard.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/clk/clk-xlnx-clock-wizard.c b/drivers/clk/clk-xlnx-clock-wizard.c index d403a74..7f09522 100644 --- a/drivers/clk/clk-xlnx-clock-wizard.c +++ b/drivers/clk/clk-xlnx-clock-wizard.c @@ -472,8 +472,10 @@ static int clk_wzrd_probe(struct platform_device *pdev) u32 reg, reg_f, mult; unsigned long rate; const char *clk_name; + void __iomem *ctrl_reg; struct clk_wzrd *clk_wzrd; int outputs; + unsigned long flags = 0; struct device_node *np = pdev->dev.of_node; clk_wzrd = devm_kzalloc(&pdev->dev, sizeof(*clk_wzrd), GFP_KERNEL); @@ -543,16 +545,17 @@ static int clk_wzrd_probe(struct platform_device *pdev) } outputs = of_property_count_strings(np, "clock-output-names"); - /* register div */ - reg = (readl(clk_wzrd->base + WZRD_CLK_CFG_REG(0)) & - WZRD_DIVCLK_DIVIDE_MASK) >> WZRD_DIVCLK_DIVIDE_SHIFT; + if (outputs == 1) + flags = CLK_SET_RATE_PARENT; clk_name = kasprintf(GFP_KERNEL, "%s_mul_div", dev_name(&pdev->dev)); if (!clk_name) { ret = -ENOMEM; goto err_rm_int_clk; } - clk_wzrd->clks_internal[wzrd_clk_mul_div] = clk_register_fixed_factor + ctrl_reg = clk_wzrd->base + WZRD_CLK_CFG_REG(0); + /* register div */ + clk_wzrd->clks_internal[wzrd_clk_mul_div] = clk_register_divider (&pdev->dev, clk_name, __clk_get_name(clk_wzrd->clks_internal[wzrd_clk_mul]), flags, ctrl_reg, 0, 8, CLK_DIVIDER_ONE_BASED | @@ -577,7 +580,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) if (!i) clk_wzrd->clkout[i] = clk_wzrd_register_divf (&pdev->dev, clkout_name, - clk_name, 0, + clk_name, flags, clk_wzrd->base, (WZRD_CLK_CFG_REG(2) + i * 12), WZRD_CLKOUT_DIVIDE_SHIFT, WZRD_CLKOUT_DIVIDE_WIDTH,