From patchwork Fri Mar 23 13:33:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 10304931 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 798DC60386 for ; Fri, 23 Mar 2018 14:56:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68CD628F1E for ; Fri, 23 Mar 2018 14:56:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D22728F23; Fri, 23 Mar 2018 14:56:16 +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=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 3D4BB28F1E for ; Fri, 23 Mar 2018 14:56:15 +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: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:In-Reply-To:References: List-Owner; bh=O1zhEkegZwcKkZAw2cCCDLC9jtv4d2aelVPvlps6KqI=; b=rb/OwPrATItgRv 24fUU2ejVrNO8B9wJN83kyvK+aJA6WhjrHHGNmaRAGKh1NKFf42GqfLiFU2kHZE6iT9H4PHuv/UQq lmJdU9fO1/2Tgd44ByVrmY7OguWpG22AxHh1omeLNG1D+kofFNWf0P1jrdrh5cvT67xOG2ASWkSoL Ay8gx6dhnuIYJEYk2e0HziuNDZJ4sF0/HA/ihvvWBZjTtrOT0kOY5vVxl6NDDoV0E+EKOI09dNoDR YUbByaVjflJYODZlgXNr8p7X6XpW2LQGr5PtNWOZMGnc6a1W9rrvHG1WbpcAFxqnvhCxkhrNvCHqJ Xxji/iNasjg8anF8OzNw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ezO6z-0001pL-2y; Fri, 23 Mar 2018 14:56:09 +0000 Received: from mail-sn1nam01on0075.outbound.protection.outlook.com ([104.47.32.75] helo=NAM01-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ezO6o-0001bJ-31 for linux-arm-kernel@lists.infradead.org; Fri, 23 Mar 2018 14:56:01 +0000 Received: from CY1PR03CA0017.namprd03.prod.outlook.com (2603:10b6:600::27) by MWHPR03MB2880.namprd03.prod.outlook.com (2603:10b6:300:11c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Fri, 23 Mar 2018 14:55:44 +0000 Received: from BN1AFFO11FD009.protection.gbl (2a01:111:f400:7c10::171) by CY1PR03CA0017.outlook.office365.com (2603:10b6:600::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.609.10 via Frontend Transport; Fri, 23 Mar 2018 14:55:44 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; 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 BN1AFFO11FD009.mail.protection.outlook.com (10.58.52.69) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.527.18 via Frontend Transport; Fri, 23 Mar 2018 14:55:43 +0000 Received: from fsr-ub1664-175.ea.freescale.net (fsr-ub1664-175 [134.27.109.41] (may be forged)) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w2NDXnoH001133; Fri, 23 Mar 2018 06:33:49 -0700 From: Abel Vesa To: Shawn Guo , Fabio Estevam , Michael Turquette Subject: [PATCH] clk: imx: Set CLK_SET_RATE_GATE for gate and divider clocks Date: Fri, 23 Mar 2018 15:33:26 +0200 Message-ID: <1521812006-6173-1-git-send-email-abel.vesa@nxp.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131662905441026728; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:CAL; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39380400002)(346002)(39860400002)(376002)(396003)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(305945005)(68736007)(104016004)(110136005)(54906003)(47776003)(59450400001)(51416003)(106466001)(8676002)(2906002)(5660300001)(50226002)(356003)(4326008)(81166006)(105606002)(48376002)(26005)(81156014)(85426001)(498600001)(1857600001)(336012)(50466002)(26826003)(8936002)(956003)(16586007)(316002)(53936002)(97736004)(6666003)(86362001)(36756003)(42866002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2880; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD009; 1:8/6wAYbTMdE2bfYybhCZdxPDelcc8QNKEQFSUoG4L/4SbUykERTgjJ/pTq12YtNA3Sdn4mSWjyTL0cE14fHhm04HPveP06lNGIR6Bb8JqPB1swX+ME3RKkgRDd9QSxOr MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d7833822-fcd2-4593-2148-08d590ce275d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603328); SRVR:MWHPR03MB2880; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2880; 3:ElBsZRWkzYev1Cboyfy8pJcvIT0RRUHDCmCmU4xiC4bxkcwd12WqO0awoF7DZsqWcgPRHN1I0EyTXkOc/qvxJdAsUrlpPpZYovZ366AXIDnkYBDH7VQFeR6ty/a8VkedK+/DOMrcNJk7M4vZQZaBMr4hVB5QgNn1D3c8+/Halx370Icl435fgg4avQYY/tylSCA9Z2nTnqiOhz6MJMB8IWP3NgDxoFxBcq++6Yv+kqhW8CRTpGs/PR/MGG4d2NJQ/4MlwX/pRd5AREjBBxoDxkVIVe9Hej/YJbwOwqBo7zBj4Holf9IvUGcepMdUOhb3w2on2aSa4L+vFgXwoPhM3Ia6kdi0l3dlAJ1+UoV51k0=; 25:XfM1pmjFsIsyKffuL3ap+DxmODmI2MmlZUTvqV/qksXE6AOXatLkMVf7uqYdeBL6KKi6IhSnVTUf3OrXS5hjgn14N6ROWuXZnPg/IvGEJ76jcyLO3Iq2lkZjIUYzwblaT9W2RqJ/H9CwFd4CaAxEN4p8vo/DO1FyWVRhy2ZxpoRL+KPXwEmhSaGy714bn2U7LTX6lbKrXgofGFWMGglzdz7LHW0Ff2Rr4671C+kL3Ek8bNO/uNeWAJNhttVuiBzCsLQgFOgs0R4gFNIevIrA/VbI+l+/KGOlB8XjwNWGgeNp53IpiuIfmPeIS0bD8gC5waEX6kn7jXPsPbUp8SesEw== X-MS-TrafficTypeDiagnostic: MWHPR03MB2880: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2880; 31:4CP0K/M3wDtmqS9a2AginN1KEUpivzhWzufAFBXVO6gxfoO8iL0ZAbK3s/LMmWAcBuF8yJ+qow4I3rNLr4179Nk0De3/wO3qo2MCAQf4KWWa1fZutrZfuFbZnrHizfgZl3QjeFjsipGJLaiwiC/ApY9GCfOHia+AcCOf23rZ3IJO8BHiTzCmL7Cby8JIWptJF/sDMVq024tL3cYl2f4Umm31qScEcZvJhgY097EYEF8=; 4:Q5iwmyL2dW2htz9aylus7ffBRXri+0fAFl3vnn1CTBDmEWG7QPPEOR9kwCllkw10DuE2SdjgQxIc0myuR8bYCQXZhubcsR+8iRcJSKMGdGAk6LNVQfB9/QHbJ+7n11Y8owzdsMBax8OVhy10gq7+BdNZcyBQZMpMLEmjCtPNSAtT4Z7rx4IvyRS24MaQrvhMLUxWaZvw+af+efkoD2psdTQRVr6tEgD8caDr/NHgCtBx31ktlqJx7OZmeuBt/PRS1KBfEQA4YD7moh8dgMZE6650TFkjz9cMv+1Yi8/PdMbiMz06xNu21h+icz5R5cxs X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(3231221)(944501327)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123565025)(20161123559100)(201703131430075)(201703131448075)(201703131433075)(201703151042153)(20161123556025)(20161123561025)(201708071742011); SRVR:MWHPR03MB2880; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2880; X-Forefront-PRVS: 0620CADDF3 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2880; 23:iGW0mWvuNpuYAl46qkK6Xw4pY7FZ2yCaa7gBDrG1q?= =?us-ascii?Q?2mytwZw8edmdj2Bbjb+EdmjDWpDFFpnpFPneh/vezXbj0tlSJTa1n0pOPuJ/?= =?us-ascii?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8PssPGigObJNtJosE4vll5QHZjBASESIVS8X4FfzsJdSBugk2CfZzrGKFmPktj3pkdLZPQfLtKixShYsQ+q/ugwyXjWzBDvKOo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2880; 7:kTV4kbEjO+THZZSyvLCXJI6t0pGSaCDUJao4Nhyzqc5csmboUHuaqBf2nyXJFiRJp/TJaeHmVUcckoeIU29nnX2A8NHaivklQWrdoL8TfAnB0VFw4GD+qbbo8jWW/Ln/MPZt+w0NL0lpBVshCW9VM/lfF6EZ5GHYS2YGlIwiCPbGzdCxulCWAf2mKe6iemg/Zv/um6gMxiISXsbzoPQfLCsYewEARrB5oIGcLpSJ9zezOY7kMqh15qcU9CjlgvDW X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2018 14:55:43.5098 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7833822-fcd2-4593-2148-08d590ce275d 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: MWHPR03MB2880 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180323_075558_398245_FEF1BDF2 X-CRM114-Status: UNSURE ( 7.73 ) X-CRM114-Notice: Please train this message. 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: Abel Vesa , Stephen Boyd , linux-kernel@vger.kernel.org, Abel Vesa , linux-imx@nxp.com, linux-clk@vger.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 Add flag CLK_SET_RATE_GATE for i.MX gate and divider clocks on which the client drivers usually make clk_set_rate() call, so that the call will fail when clock is still on instead of standing the risk of running into glitch issue. Rate cannot be changed when the clock is enabled due to the glitchy multiplexers. Signed-off-by: Shawn Guo [initial patch from imx internal repo] Signed-off-by: Abel Vesa [carried over from 3.14 and also applied the flag to newer functions] --- drivers/clk/imx/clk.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index d69c4bb..4411719 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -96,7 +96,8 @@ static inline struct clk *imx_clk_fixed_factor(const char *name, static inline struct clk *imx_clk_divider(const char *name, const char *parent, void __iomem *reg, u8 shift, u8 width) { - return clk_register_divider(NULL, name, parent, CLK_SET_RATE_PARENT, + return clk_register_divider(NULL, name, parent, + CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, reg, shift, width, 0, &imx_ccm_lock); } @@ -133,7 +134,8 @@ static inline struct clk *imx_clk_gate_dis(const char *name, const char *parent, static inline struct clk *imx_clk_gate2(const char *name, const char *parent, void __iomem *reg, u8 shift) { - return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg, + return clk_register_gate2(NULL, name, parent, + CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, reg, shift, 0x3, 0, &imx_ccm_lock, NULL); } @@ -141,7 +143,8 @@ static inline struct clk *imx_clk_gate2_shared(const char *name, const char *parent, void __iomem *reg, u8 shift, unsigned int *share_count) { - return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg, + return clk_register_gate2(NULL, name, parent, + CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, reg, shift, 0x3, 0, &imx_ccm_lock, share_count); } @@ -150,8 +153,8 @@ static inline struct clk *imx_clk_gate2_shared2(const char *name, unsigned int *share_count) { return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT | - CLK_OPS_PARENT_ENABLE, reg, shift, 0x3, 0, - &imx_ccm_lock, share_count); + CLK_SET_RATE_GATE | CLK_OPS_PARENT_ENABLE, + reg, shift, 0x3, 0, &imx_ccm_lock, share_count); } static inline struct clk *imx_clk_gate2_cgr(const char *name, @@ -173,7 +176,7 @@ static inline struct clk *imx_clk_gate4(const char *name, const char *parent, void __iomem *reg, u8 shift) { return clk_register_gate2(NULL, name, parent, - CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, + CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE | CLK_OPS_PARENT_ENABLE, reg, shift, 0x3, 0, &imx_ccm_lock, NULL); }