From patchwork Mon May 15 13:59:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 9727073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9962560380 for ; Mon, 15 May 2017 14:02:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A3E428066 for ; Mon, 15 May 2017 14:02:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C9B628419; Mon, 15 May 2017 14:02:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1BEAB28066 for ; Mon, 15 May 2017 14:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bHM/78fIfN/xJcQ6j5El7d0Gq2Rb875rXCl7Ge2B5gA=; b=hKd91Id5rOyPhM qudUR9lJAfHl1HOXl3a8QB9xWwfFW25qimTg7jcsrVVL0F5zj7Vm+Ss9K13BiQCbulA2uJEnjqliY EIbWS+vKHUBUskzDPnu8BAUOzbxzyMaSUxOkOJIFzG9Po5fCyEZA/Jz3d9dNFlFNO2avUpNtsosqa 15h1QSp+wO3rCk/tyC/h0rkLX28RMRbc/LlsXZtZT568KsfLwEjCVqbeQewehQu4+XMOy9t+mzAt3 PtBM596f31ZXnLSXZ7KaT88VrAeCWjJPv6eCfJ2n7all8D0v/EJ+1yzNumM9YwBYvN6kHYYX+J9K8 5/KuKBuok6Wllbgn7/Ug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dAGZr-00015m-DV; Mon, 15 May 2017 14:02:23 +0000 Received: from mail-sn1nam02on0079.outbound.protection.outlook.com ([104.47.36.79] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dAGXP-0005Nu-OJ for linux-arm-kernel@lists.infradead.org; Mon, 15 May 2017 13:59:56 +0000 Received: from BN3PR03CA0116.namprd03.prod.outlook.com (10.174.66.34) by CY1PR0301MB0907.namprd03.prod.outlook.com (10.160.165.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Mon, 15 May 2017 13:59:29 +0000 Received: from BN1BFFO11FD025.protection.gbl (2a01:111:f400:7c10::1:164) by BN3PR03CA0116.outlook.office365.com (2603:10b6:400:4::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16 via Frontend Transport; Mon, 15 May 2017 13:59:28 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD025.mail.protection.outlook.com (10.58.144.88) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1075.5 via Frontend Transport; Mon, 15 May 2017 13:59:28 +0000 Received: from b29396-OptiPlex-7040.ap.freescale.net (b29396-OptiPlex-7040.ap.freescale.net [10.192.242.182]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v4FDxEqj015180; Mon, 15 May 2017 06:59:25 -0700 From: Dong Aisheng To: Subject: [PATCH 3/9] clk: fractional-divider: add CLK_FRAC_DIVIDER_ZERO_BASED flag support Date: Mon, 15 May 2017 21:59:17 +0800 Message-ID: <1494856763-6543-4-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494856763-6543-1-git-send-email-aisheng.dong@nxp.com> References: <1494856763-6543-1-git-send-email-aisheng.dong@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131393303687712221; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39410400002)(39850400002)(39380400002)(39860400002)(39840400002)(39450400003)(39400400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(9170700003)(4326008)(47776003)(50226002)(68736007)(8656002)(6666003)(5660300001)(54906002)(6916009)(2906002)(2950100002)(77096006)(50986999)(76176999)(105606002)(356003)(106466001)(8676002)(50466002)(48376002)(8936002)(33646002)(104016004)(36756003)(5003940100001)(81166006)(2351001)(85426001)(189998001)(38730400002)(305945005)(86362001)(498600001)(53936002)(110136004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB0907; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD025; 1:NURBUA5+Mkj59JpbNAAphzQOSOvNixZyNbTxPia7iLhyGU30qaEwgB9sQ3qrK1JrteT6BCUvjknePSQfcTdQ55H8ZkuBL5zVs8CuzotFFIIJi/JYAvUyPkf2XyktR/SH9jToHICeMMI2t4W/cOLmH1Fn7vM8Rt7BSn0tZrYCGZ6h5rjQyZT13L5Xti8wDgB09BJeylgcb3yNMsSzKWD/H+WtpXb3lkLRd+GwMVMfoMXdqisfO7tH/reNF4BY8j7DM3KXdDQBJPVE349h1A7uKeQWeLc6ZyuKQN/B0NrVNmr7tv69tWvSrOQQuUFfCQvBJ9Tnjbd6K22xk2NIIFU4k6e4UNmDLDO15qto6Ar6ZJUY3uKYHuV4bb0+Dct65YNSevOMFbRa0JdpisByVo6TrTDBZ+IorfcGaMtBhAXZ3iI9oVJIXJaeQnmmNby0hC44Q/kdPuSJQfGqVfMmzDfHYsFe3z8YPDKv3vMQjz1zxj+MXqGfdLdN8FWRDZ8cIEetDrKreWT2M8GSin25BQfwcZbpNFNsw0bQphp9awBfqCMzOHoKXbFBGJcMirrN3Wuhenx9EWQtOeB+UdaWGtV1CfjzfrwJm7cw8qfvWCFIuxhmhBuVNEzx8v2252sJgMZMFJJmtJAcSpYzEfH6aU9RqjUjCyWysli4B6hpFMu+Z1FNalu9KavKKNajr8u7DqwuuI1Tjjnsio2+0aAbGKFJlzVP7i9SKMmHB4RrlQ6U4vE= MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f6032977-2351-4923-6c7e-08d49b9a9aa0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:CY1PR0301MB0907; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0907; 3:YzRnVxJKqMHBjtedLOfEf4yicthzOvhgeoDzz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eikIWEbSUoEgW1+7k2goYjgeuiBvPF+nM14jzMw14I3G6qJprxLIuInSCLT5yW/Iur/AqV2d9/m69tMhtMzweFyFahJ5+YSeWmJFAiHL1pBVQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13023025)(13018025)(13024025)(5005006)(8121501046)(13015025)(13017025)(3002001)(93006095)(93001095)(10201501046)(6055026)(6096035)(20161123561025)(20161123565025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123556025)(20161123559100)(20161123563025); SRVR:CY1PR0301MB0907; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB0907; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB0907; 4:JicGBMGSyyQLnN+ll/zbcluuuEkHKIGmVcOXQyBH?= =?us-ascii?Q?Fw08Ok/GrEHTGbsRZ4N0cOrd4lv5bcFVuS1K2ncsMfsL+DWrSAZICxmEqP0y?= =?us-ascii?Q?N/j6HKsP9XkbhKW6XNVnbU/zwGsjeu99pgzLBestAZXeSX1z+bxZtg0XqIbL?= =?us-ascii?Q?qIHj4isWgWKTzB/5FAguTXmFjLE3Njz744r9ghFL9wnhS8Oqg66Tdl1nc4Rx?= =?us-ascii?Q?Bz7oSnOU+TAfG0sE7HOupc4Hn9L2aZ08tfi0zv/8A37QMKFp4bwm9gvJEov+?= =?us-ascii?Q?6DxEFFnx36ofscXnP2gQ1U+lKQshoGgSArcS5T6fUOP/AVsGFPqJZZk1rVP6?= =?us-ascii?Q?oYt4nD7/a9Tpw8tXV1M9rrN9NIwpo65xfxubX8rGmE1LGmiqtgco7Zc58GMp?= =?us-ascii?Q?5lpSW6OcNb7nJT/w2v1cynrkfNPQuHBLNOYVdWiKvQ+yv0249pSuBexal8zU?= =?us-ascii?Q?9/IomVpNUERA2c8RNtcOt+w6mv3mYpGtixMzFRG5Wm3kPT2+neAvbp74HouB?= =?us-ascii?Q?sOu5CdynCFoNc3RqxFKjYaFLAzymeTKvLwKlAsG7lGMLxYEFKZTjjzS8GMEn?= =?us-ascii?Q?aicBTHrvKlfmoR7e63v25/MHMgNU0nK025ZS94yU/wpaKE6/Y6wshJ69uVTJ?= =?us-ascii?Q?WltoMU76H4KNZiXEgar7IdddMW91cbwKuVsC5i0LzFdU7QZDKbAaVOgIO3vf?= =?us-ascii?Q?nxK2nEZUGZe9s3kfuLe56yv8tMhTIXsUCtHU4s/M3NUdlAxAzn/LGMSVLgWL?= =?us-ascii?Q?7k+XsVjYHwVWljSCFe6i8C9BLtEKW7KDK/w01Ms+88hyno7HeMS3aja8/XcV?= =?us-ascii?Q?gUJrtOB/v/oA6zGbeE5Ulj8V3GaFPS6OcBQRW/iyWY5oBoyrADNxw6eZ9cIf?= =?us-ascii?Q?q6NHQYrgDhu/Kbmy0GgqKQz/nt7Uv7mhbXIl3lbeDlUhG4Ut8zmAok3LbAOU?= =?us-ascii?Q?uIofKTq92ZKfQQEVeb1Sat+ojcFgOtvZo1JpJGz99g=3D=3D?= X-Forefront-PRVS: 0308EE423E X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB0907; 23:SbWGZCrW/cX+kUP/ggkMWhdx0kjBG1hR3wBU8iN?= =?us-ascii?Q?5NB6D3QEwQlv0xrHVxV0+KTHXREP+yQIq/sp+Er1jUsvU9jhKPapqHMuwdqb?= =?us-ascii?Q?RQRviHMDHQg4sNZTlqc61Jdx00+IHxObgn9nWRIvBa/nlNCO228mW9rkWAuY?= =?us-ascii?Q?wNQ4rY9ogKWMf5H742/Vzbad3RLeBkAvWnxgRHAheaENEjBbR1gD5d4qpCkA?= =?us-ascii?Q?kVZlToC7d5cyznIEXSoSjCEx00m6OJ2PeZSQB+/QzTlB1+ygRcU+6mLzkJAP?= =?us-ascii?Q?c/da1jODTvWkgLS0UMUaAgT0zVguRO5DC7ROTvXQP5vatKi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vLB+nQFyBiwGmvTlHBAzTECBL7wtH++U?= =?us-ascii?Q?/cemEtGJeM/tZee7GfGmxT4K3RFRI8Eqe6bG+tDBf?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0907; 6:GEQulX55iuOG8tQWY4ITyg1kbNGs7bQCSdI6fB8U84LX9i+eSPp9gDsGlsALFPqfWi6twmTNvIKnKS2KKEGFWCoL6KNc5rpnmmd7+hQfx+Gd+BlHNGhf+BsI1BTardl4AEwF4jCxgbmDALUqPURv2VgeikI/E8p4vs7fvMeO+PQIhEFsHS82qRmmLg4oxUl1uryyJbo4eIQditG8io0fvjB3C9Q/f0N5D/lcm7xen+LqDyB5wPkPG72k3ckTa3hmQuAP4tPJ4aScAl/KCsdjBGdkwJSfxe3FL3i9fzx7d7gsIefLN6dO2FI9++vBqJfA5qOaQr2sT+tLteV9cpUA3KhtpTs8cahJjv/mkmYwnCW0A5QGs/eHAvlURHUJQYP5pRzDP05FH0bPaI74T4ft2ztx9WOoZjIIZFD0hNqJHicbwIH1yV8O5aaUAUi1gq4hI5hkNlbIGGqanh1jtbCIVQcBw+d+h4wvZ1+KyTpgzHe9XgCvo7D4pwkywFpu8oQl/JxrpdIe6EYDH1o95P+PBQ==; 5:XpgtBPp0gWYmsJtRZPlx28iihp6niI2HUXx8MU0drFoucvlttG5tiF8gq+LwFopso/JtyOhUj057SpKM/DKO5DuMIWhkopHJ1rn8cSHX6vWk4tCBforDJMFcY2AAJZIr7PSvcAH+OU9MfqI+QiYgSVFMo8571mmdKaw8wK8NavX0rlzLhZ3tXTj7jnpddQ0m; 24:m/neZUn3eQjyxEqKcUdbtQNhBkNVH/9QsiY6sxkVsN9j0iLAx5CvC/7AEIJ70n8P/T8XzyvONdr/+rQynXeLeRFEnN9qzGv0vaH2dHFMXXA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0907; 7:B3w05S2KT/1DSAbLfBmspJMHvH28PtAnOvEiiEuEOxhAa1hT3+j7yH5Gaq9qf3+or+dQLSAkklhwGWSM5bxB6WNbMZ5y/yakOc0/DQJ6hvwLGxZ6xkwAn1IwLzaFvnDP9fLSCtXYjNGAUHEDbx4J8sGinHk33uiaVmV4QmiC24GWxT/ZQfqH1bN4+ViKAq5+TZ9EqshDrj37gY35EbIrtiuYJFQiDPLa8SBhmoTo5WlLeXW9VIkiO01W5KKNwISM3ZEO6CQp1Q6fj9nn6VyRVC4jK95luSgJL1TlYuJZ50XwFSSNGFK9vTVl7RdBrjzbdEu6ULZWn9bcH9zkjwslrw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2017 13:59:28.5840 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB0907 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170515_065952_206187_B1A832C3 X-CRM114-Status: GOOD ( 15.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dong Aisheng , ping.bai@nxp.com, Anson.Huang@nxp.com, mturquette@baylibre.com, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Adding CLK_FRAC_DIVIDER_ZERO_BASED flag to indicate the numerator and denominator value in register are start from 0. This can be used to support frac dividers like below: Divider output clock = Divider input clock x [(frac +1) / (div +1)] where frac/div in register is: 000b - Divide by 1. 001b - Divide by 2. 010b - Divide by 3. Cc: Stephen Boyd Cc: Michael Turquette Signed-off-by: Dong Aisheng --- drivers/clk/clk-fractional-divider.c | 10 ++++++++++ include/linux/clk-provider.h | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c index aab9046..455bec5 100644 --- a/drivers/clk/clk-fractional-divider.c +++ b/drivers/clk/clk-fractional-divider.c @@ -40,6 +40,11 @@ static unsigned long clk_fd_recalc_rate(struct clk_hw *hw, m = (val & fd->mmask) >> fd->mshift; n = (val & fd->nmask) >> fd->nshift; + if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) { + m++; + n++; + } + if (!n || !m) return parent_rate; @@ -91,6 +96,11 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate, GENMASK(fd->mwidth - 1, 0), GENMASK(fd->nwidth - 1, 0), &m, &n); + if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) { + m--; + n--; + } + if (fd->lock) spin_lock_irqsave(fd->lock, flags); else diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index a6efbb9..4466cae 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -557,6 +557,11 @@ void clk_hw_unregister_fixed_factor(struct clk_hw *hw); * @lock: register lock * * Clock with adjustable fractional divider affecting its output frequency. + * + * Flags: + * CLK_FRAC_DIVIDER_ZERO_BASED - by default the divisor is the value read + * from the register. If CLK_FRAC_DIVIDER_ZERO_BASED is set then the + * divider is the raw value read from the register plus one. */ struct clk_fractional_divider { struct clk_hw hw; @@ -573,6 +578,8 @@ struct clk_fractional_divider { #define to_clk_fd(_hw) container_of(_hw, struct clk_fractional_divider, hw) +#define CLK_FRAC_DIVIDER_ZERO_BASED BIT(0) + extern const struct clk_ops clk_fractional_divider_ops; struct clk *clk_register_fractional_divider(struct device *dev, const char *name, const char *parent_name, unsigned long flags,