From patchwork Fri Nov 22 10:48:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11257811 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70210109A for ; Fri, 22 Nov 2019 11:18:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E9CD20721 for ; Fri, 22 Nov 2019 11:18:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="kH5aH8Ug" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727636AbfKVLSY (ORCPT ); Fri, 22 Nov 2019 06:18:24 -0500 Received: from mail-eopbgr20045.outbound.protection.outlook.com ([40.107.2.45]:34373 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729908AbfKVKsV (ORCPT ); Fri, 22 Nov 2019 05:48:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GOU5BJk8yPY+dTOu90Sipiq2VJ1oh0YIRk31QDkIbpzLEK7j+ol8+E7MRxezhcby3NO+2fSl5Z71D9ZZp6igz09qzqhJCvYVKs1ZJVCL4gpseHp8J53HZLp1neJqg/iCKqzOAiZQRsZ+T+HkrEboQeeP0YVOCWZ7asq1Xr6wl3r/VUvLblJPFM4bT4bHIUlLR6PJVsE2mRBwbqk6rdkHY1+9LSzXhsY9H58gs0lyAXFtbxHU8jHKaRmqPzF1PjlOU9b2di+KjSxsPn0xRwF2KeUHssrWQ0RGoSTntaicXaRvVjqB4Y4nQN4sydKxYZA7QA1PaUagDpO5uxQHCN1qqA== 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=hpB7/h8s8+NB1zXHlwW1O5r1FDB+BYRcST9UVjrcAD4=; b=WqcLkN0hF+CsGfHlEq4I8Ueag4mkPFkg8rLLTzWAxsXqEv7z6iMEy271IpllqevCXkRuKkuRDggB1Ecv7E69aiYphFI4GHRoW7aXMAb5CXm8jqtfRQQzPjb+xIPjXzpzfp1f/TlTctsPIzcqCuGstbJcyyMBr9vE/WsAYukT+zrQQ5cfjT2FSz5YNnNP1uiJW6us33ZbeOS2ZmeJUEBsxzna4RE8jGYN+GQ8PztzQuPTdRR3eDc6EGoVXjGF/4dsV/NhXVV+mfxJaieXXu5eRD0ZVcPy/tXy4iJ6zco/lIzj4qsHqUZ9ueTnNGwVvsCDjrajXMmcnocFVTSn9SMwSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hpB7/h8s8+NB1zXHlwW1O5r1FDB+BYRcST9UVjrcAD4=; b=kH5aH8Ugn17NzwpBA9iGkiCbNpOars+hkY8MEW2zbxchEXIYskkOrabaKncIMleROk4JGGX5gg3hFobIU0znH/Z0iVl5VgQ+7G4I/BIXXk6f/IamrZmw9VkV/GRAe6BTiH8j8AupyrQ9BDSe5zoqUVAFeYbsy0PRGliiTtwv7XU= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB5074.eurprd04.prod.outlook.com (20.177.42.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 10:48:11 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde%7]) with mapi id 15.20.2474.019; Fri, 22 Nov 2019 10:48:11 +0000 From: Abel Vesa To: Aisheng Dong , Shawn Guo , Leonard Crestez , Stephen Boyd , Sascha Hauer , Jacky Bai CC: Peng Fan , dl-linux-imx , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Abel Vesa Subject: [PATCH v2 01/11] clk: imx: Add correct failure handling for clk based helpers Thread-Topic: [PATCH v2 01/11] clk: imx: Add correct failure handling for clk based helpers Thread-Index: AQHVoSJV3+BGHUQPMkG8d0LKK8nz2A== Date: Fri, 22 Nov 2019 10:48:10 +0000 Message-ID: <1574419679-3813-2-git-send-email-abel.vesa@nxp.com> References: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:208:15::33) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.7.4 authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 630c59f2-36db-42ac-3649-08d76f3977ab x-ms-traffictypediagnostic: AM0PR04MB5074:|AM0PR04MB5074: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 02296943FF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(346002)(376002)(396003)(136003)(189003)(199004)(478600001)(14444005)(256004)(6506007)(54906003)(7736002)(305945005)(316002)(71200400001)(5660300002)(110136005)(102836004)(186003)(86362001)(66066001)(71190400001)(2906002)(4326008)(76176011)(99286004)(36756003)(26005)(52116002)(386003)(8936002)(3846002)(2616005)(446003)(44832011)(11346002)(66556008)(66476007)(66446008)(64756008)(6486002)(66946007)(6436002)(81166006)(8676002)(81156014)(6636002)(6512007)(25786009)(14454004)(50226002)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB5074;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: iV4gbwLuQW9Vq7UdzckzTsAHAhPxbNSSDRCDIb+AVKDhhn9aSN+xVB+PNUv2QFY6c0GYuwCXxEMNf3RwrOclK6IhfgYU1UMYn4MUBp8n6o61mfA3wDffaZkCalF5Q6LjvTOWb2Xc3uBX7X9eTNkEUoETOCiPVjuJ3CrVmRcsnMviWNW0VzyGtg9kyeifemuf3w7DFM5mDbGijTFpB3pRE/Ru093+RSbtfLecSgfv/G1Rw5+/0++/RTgvPxLJu6GMLkDm0wxenAqoMdfgCfaEWXdr8klUNhlkigjuCfuCKWuje0DKBtayXwZqR8b92+yg8zC2OU9ma/mbzKXvJ3pCZiQImuJjR8STUsur1s02aMhHnFs9dJRh3hwwJ8ZfvMkdVbg1bGIxsikaoPmEYc6jnqyAlaOZAARNvBPikElLHLGWr1vxAuM++H5sxpD7o9HY MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 630c59f2-36db-42ac-3649-08d76f3977ab X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2019 10:48:10.9281 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: PajE31Amud/CMtt87ufpFQrVMVnXnaOObcOXi/W37kOoKIau5sxHR23VNtOqpua9paDEr0a0kLqaqOL3iYHSew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5074 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org If the clk_hw based API returns an error, trying to return the clk from hw will end up in a NULL pointer dereference. So adding the to_clk checker and using it inside every clk based macro helper we handle that case correctly. This to_clk is also temporary and will go away along with the clk based macro helpers once there is no user that need them anymore. Signed-off-by: Abel Vesa Reviewed-by: Leonard Crestez --- drivers/clk/imx/clk.h | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index bc5bb6a..30ddbc1 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -54,48 +54,48 @@ extern struct imx_pll14xx_clk imx_1416x_pll; extern struct imx_pll14xx_clk imx_1443x_pll; #define imx_clk_cpu(name, parent_name, div, mux, pll, step) \ - imx_clk_hw_cpu(name, parent_name, div, mux, pll, step)->clk + to_clk(imx_clk_hw_cpu(name, parent_name, div, mux, pll, step)) #define clk_register_gate2(dev, name, parent_name, flags, reg, bit_idx, \ cgr_val, clk_gate_flags, lock, share_count) \ - clk_hw_register_gate2(dev, name, parent_name, flags, reg, bit_idx, \ - cgr_val, clk_gate_flags, lock, share_count)->clk + to_clk(clk_hw_register_gate2(dev, name, parent_name, flags, reg, bit_idx, \ + cgr_val, clk_gate_flags, lock, share_count)) #define imx_clk_pllv3(type, name, parent_name, base, div_mask) \ - imx_clk_hw_pllv3(type, name, parent_name, base, div_mask)->clk + to_clk(imx_clk_hw_pllv3(type, name, parent_name, base, div_mask)) #define imx_clk_pfd(name, parent_name, reg, idx) \ - imx_clk_hw_pfd(name, parent_name, reg, idx)->clk + to_clk(imx_clk_hw_pfd(name, parent_name, reg, idx)) #define imx_clk_gate_exclusive(name, parent, reg, shift, exclusive_mask) \ - imx_clk_hw_gate_exclusive(name, parent, reg, shift, exclusive_mask)->clk + to_clk(imx_clk_hw_gate_exclusive(name, parent, reg, shift, exclusive_mask)) #define imx_clk_fixed_factor(name, parent, mult, div) \ - imx_clk_hw_fixed_factor(name, parent, mult, div)->clk + to_clk(imx_clk_hw_fixed_factor(name, parent, mult, div)) #define imx_clk_divider2(name, parent, reg, shift, width) \ - imx_clk_hw_divider2(name, parent, reg, shift, width)->clk + to_clk(imx_clk_hw_divider2(name, parent, reg, shift, width)) #define imx_clk_gate_dis(name, parent, reg, shift) \ - imx_clk_hw_gate_dis(name, parent, reg, shift)->clk + to_clk(imx_clk_hw_gate_dis(name, parent, reg, shift)) #define imx_clk_gate2(name, parent, reg, shift) \ - imx_clk_hw_gate2(name, parent, reg, shift)->clk + to_clk(imx_clk_hw_gate2(name, parent, reg, shift)) #define imx_clk_gate2_flags(name, parent, reg, shift, flags) \ - imx_clk_hw_gate2_flags(name, parent, reg, shift, flags)->clk + to_clk(imx_clk_hw_gate2_flags(name, parent, reg, shift, flags)) #define imx_clk_gate2_shared2(name, parent, reg, shift, share_count) \ - imx_clk_hw_gate2_shared2(name, parent, reg, shift, share_count)->clk + to_clk(imx_clk_hw_gate2_shared2(name, parent, reg, shift, share_count)) #define imx_clk_gate3(name, parent, reg, shift) \ - imx_clk_hw_gate3(name, parent, reg, shift)->clk + to_clk(imx_clk_hw_gate3(name, parent, reg, shift)) #define imx_clk_gate4(name, parent, reg, shift) \ - imx_clk_hw_gate4(name, parent, reg, shift)->clk + to_clk(imx_clk_hw_gate4(name, parent, reg, shift)) #define imx_clk_mux(name, reg, shift, width, parents, num_parents) \ - imx_clk_hw_mux(name, reg, shift, width, parents, num_parents)->clk + to_clk(imx_clk_hw_mux(name, reg, shift, width, parents, num_parents)) struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, void __iomem *base, const struct imx_pll14xx_clk *pll_clk); @@ -198,6 +198,13 @@ struct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg, u8 shift, u8 width, const char * const *parents, int num_parents, void (*fixup)(u32 *val)); +static inline struct clk *to_clk(struct clk_hw *hw) +{ + if (IS_ERR_OR_NULL(hw)) + return ERR_CAST(hw); + return hw->clk; +} + static inline struct clk *imx_clk_fixed(const char *name, int rate) { return clk_register_fixed_rate(NULL, name, NULL, 0, rate); From patchwork Fri Nov 22 10:48:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11257803 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1F39109A for ; Fri, 22 Nov 2019 11:18:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C4792077B for ; Fri, 22 Nov 2019 11:18:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="F1/5SwTU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729925AbfKVKsZ (ORCPT ); Fri, 22 Nov 2019 05:48:25 -0500 Received: from mail-eopbgr70054.outbound.protection.outlook.com ([40.107.7.54]:28323 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729436AbfKVKsY (ORCPT ); Fri, 22 Nov 2019 05:48:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DSbugRl50dRzBL8elSIneMNzLxS8WmVjYKn4cwmg9TffFZXj/BFks/EhF6+jmmR7v0zAVIQcCDRuJag6tyVFZjTtzJKSMW7dP47cgCNkTM6RVd9GMqgTgOO97wZ7x8xV+hoYhZWvJIarYjT6xH8evgiDx3o7VUPyhmeeGTJoc7eBYGvqnqt+wDBkXWdfocO1z99lIXYY5vP8dQHJPCYmdwjTZtq0dKHPn8Wj6FKRuu+XbcfOT0sc7ME+DAn+NvkAkL6YiYLb5muQCLUKavPgjkGvuarnDYY/tvChMSCvsQJMgN0lVQRgEDeDTVrTWCMhpT+vKADLO6qCI5fsue+mFg== 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=co9cb+A0AGS5c92Syz8c52yrV+P87z5U37kAMuET7MY=; b=TdD4cr2gOb37Dw+mcCdSQwXEWb79zKuWV8acrfw05ppnWiCk+GnBdIiC4P42pk/0PWOXEwYPUia9de+AT9FSUnmxbkNjqcGd511IdYq47FRSaQXbsSW4j7jiOauIpw0dInIk2W6z3gdu4lG+kn4lQve5vhJxStZ8QQLgd8RwRE2tN+TGsQgmDUTeC2P29PDsVyuDgr1+eTTGGGGwE7K5Bu4amIUtwvA4YlHnzwHXNBreJuuotcW+jPwF7LWTiCsaZgN69qRD87joGhkc8A/iwYoGd5xeAwE0VSQ8WK0AreL/nvL2ZEnyza8xOePxjlTx9dXKQ/+KzfrpkmUR32cwfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=co9cb+A0AGS5c92Syz8c52yrV+P87z5U37kAMuET7MY=; b=F1/5SwTU+8zFFz5oza746JooiNHxe5PhcTMWjzNTDa7lIsfRvUeKpgUQa1uNGaGc/mRRDYEfd3TLd9aC+jVAheG4MEy0GP6yYy6RSjyVEBZkFNIU2wje/f6oMw8PdcE+O57WcbkR53CDThvmbi1M7bOM+9xURZdEDK/wzH7sxoY= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB5074.eurprd04.prod.outlook.com (20.177.42.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 10:48:12 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde%7]) with mapi id 15.20.2474.019; Fri, 22 Nov 2019 10:48:12 +0000 From: Abel Vesa To: Aisheng Dong , Shawn Guo , Leonard Crestez , Stephen Boyd , Sascha Hauer , Jacky Bai CC: Peng Fan , dl-linux-imx , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Abel Vesa Subject: [PATCH v2 02/11] clk: imx: Rename the SCCG to SSCG Thread-Topic: [PATCH v2 02/11] clk: imx: Rename the SCCG to SSCG Thread-Index: AQHVoSJVos81iAs140qQzPKlu2RTzQ== Date: Fri, 22 Nov 2019 10:48:12 +0000 Message-ID: <1574419679-3813-3-git-send-email-abel.vesa@nxp.com> References: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:208:15::33) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.7.4 authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 32aec2a1-8b4b-4844-23a2-08d76f397836 x-ms-traffictypediagnostic: AM0PR04MB5074:|AM0PR04MB5074: x-ms-exchange-purlcount: 1 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-forefront-prvs: 02296943FF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(346002)(376002)(396003)(136003)(189003)(199004)(478600001)(14444005)(256004)(6506007)(54906003)(30864003)(7736002)(305945005)(316002)(71200400001)(5660300002)(110136005)(102836004)(186003)(86362001)(66066001)(71190400001)(2906002)(4326008)(76176011)(966005)(99286004)(36756003)(26005)(52116002)(386003)(8936002)(3846002)(2616005)(446003)(44832011)(11346002)(66556008)(66476007)(66446008)(64756008)(6486002)(66946007)(6436002)(81166006)(8676002)(81156014)(6636002)(6306002)(6512007)(25786009)(14454004)(50226002)(6116002)(559001)(579004)(569006);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB5074;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 97Z1JjGEZaRD6EXCwUJyNT9c7RIPFc4X/p2UpaH+MbwRW2dlawxiP/VPITcQrnTZN2bK+GOuGNdw/DFDRUVaLBBCf77BYvVUutJiMu1P4nlX2Awdl5B0BD/piDe0cHZn5JcECBLoZxknDPOkOwoi1ERdT223b6fWbgkx6a9vk0D8y0xVnEGvxz3cpQ98c5didl0nJkuBt26Y6DWI8YgmX5a2aVM/aYMl7ZeZPjUiXyxx+jOrrL5yWR/aQH3CapQWCXfygBB/hcompSs9pqr8ZbB84nvdK4gm5kkP089InpVNDsah4PniPycr7tSVsHelY1cQQ/AJyiRJyR0k5Wd4BY5RX1s8KzoqsnQKITUu05ApPOW5/KmlDG/PGvJV+vGb5kOxo3JADjd2Dm2aYLcWvML+zJcNgv9GSEBn3uEET9NgWdtP/VmnV0wjniYBv7LmLkIsFPpfiqM0P24wc6MLH/Ccy0OSvNbkkd7E/jlkkb0= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32aec2a1-8b4b-4844-23a2-08d76f397836 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2019 10:48:12.0865 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: xAJDDFY2k/RtlIw+nM5VvZaI+78GqUPS5AZ8mDAt4VwzzjKOrAGT01ssqhdG1YGyeUtyFwCkzjLuNYIGyhW1sg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5074 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org According to the manual the acronym stands for Spread Sprectum Clock Generator. Signed-off-by: Abel Vesa Reviewed-by: Leonard Crestez --- drivers/clk/imx/Makefile | 2 +- drivers/clk/imx/clk-imx8mq.c | 6 +- drivers/clk/imx/clk-sccg-pll.c | 549 ----------------------------------------- drivers/clk/imx/clk-sscg-pll.c | 549 +++++++++++++++++++++++++++++++++++++++++ drivers/clk/imx/clk.h | 4 +- 5 files changed, 555 insertions(+), 555 deletions(-) delete mode 100644 drivers/clk/imx/clk-sccg-pll.c create mode 100644 drivers/clk/imx/clk-sscg-pll.c diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile index 77a3d71..3724ba7 100644 --- a/drivers/clk/imx/Makefile +++ b/drivers/clk/imx/Makefile @@ -18,7 +18,7 @@ obj-$(CONFIG_MXC_CLK) += \ clk-pllv2.o \ clk-pllv3.o \ clk-pllv4.o \ - clk-sccg-pll.o \ + clk-sscg-pll.o \ clk-pll14xx.o obj-$(CONFIG_MXC_CLK_SCU) += \ diff --git a/drivers/clk/imx/clk-imx8mq.c b/drivers/clk/imx/clk-imx8mq.c index 5f10a60..f2a35b1 100644 --- a/drivers/clk/imx/clk-imx8mq.c +++ b/drivers/clk/imx/clk-imx8mq.c @@ -342,9 +342,9 @@ static int imx8mq_clocks_probe(struct platform_device *pdev) clks[IMX8MQ_SYS1_PLL_OUT] = imx_clk_fixed("sys1_pll_out", 800000000); clks[IMX8MQ_SYS2_PLL_OUT] = imx_clk_fixed("sys2_pll_out", 1000000000); - clks[IMX8MQ_SYS3_PLL_OUT] = imx_clk_sccg_pll("sys3_pll_out", sys3_pll_out_sels, ARRAY_SIZE(sys3_pll_out_sels), 0, 0, 0, base + 0x48, CLK_IS_CRITICAL); - clks[IMX8MQ_DRAM_PLL_OUT] = imx_clk_sccg_pll("dram_pll_out", dram_pll_out_sels, ARRAY_SIZE(dram_pll_out_sels), 0, 0, 0, base + 0x60, CLK_IS_CRITICAL); - clks[IMX8MQ_VIDEO2_PLL_OUT] = imx_clk_sccg_pll("video2_pll_out", video2_pll_out_sels, ARRAY_SIZE(video2_pll_out_sels), 0, 0, 0, base + 0x54, 0); + clks[IMX8MQ_SYS3_PLL_OUT] = imx_clk_sscg_pll("sys3_pll_out", sys3_pll_out_sels, ARRAY_SIZE(sys3_pll_out_sels), 0, 0, 0, base + 0x48, CLK_IS_CRITICAL); + clks[IMX8MQ_DRAM_PLL_OUT] = imx_clk_sscg_pll("dram_pll_out", dram_pll_out_sels, ARRAY_SIZE(dram_pll_out_sels), 0, 0, 0, base + 0x60, CLK_IS_CRITICAL); + clks[IMX8MQ_VIDEO2_PLL_OUT] = imx_clk_sscg_pll("video2_pll_out", video2_pll_out_sels, ARRAY_SIZE(video2_pll_out_sels), 0, 0, 0, base + 0x54, 0); /* SYS PLL1 fixed output */ clks[IMX8MQ_SYS1_PLL_40M_CG] = imx_clk_gate("sys1_pll_40m_cg", "sys1_pll_out", base + 0x30, 9); diff --git a/drivers/clk/imx/clk-sccg-pll.c b/drivers/clk/imx/clk-sccg-pll.c deleted file mode 100644 index 5d65f65..00000000 --- a/drivers/clk/imx/clk-sccg-pll.c +++ /dev/null @@ -1,549 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) -/* - * Copyright 2018 NXP. - * - * This driver supports the SCCG plls found in the imx8m SOCs - * - * Documentation for this SCCG pll can be found at: - * https://www.nxp.com/docs/en/reference-manual/IMX8MDQLQRM.pdf#page=834 - */ - -#include -#include -#include -#include -#include -#include - -#include "clk.h" - -/* PLL CFGs */ -#define PLL_CFG0 0x0 -#define PLL_CFG1 0x4 -#define PLL_CFG2 0x8 - -#define PLL_DIVF1_MASK GENMASK(18, 13) -#define PLL_DIVF2_MASK GENMASK(12, 7) -#define PLL_DIVR1_MASK GENMASK(27, 25) -#define PLL_DIVR2_MASK GENMASK(24, 19) -#define PLL_DIVQ_MASK GENMASK(6, 1) -#define PLL_REF_MASK GENMASK(2, 0) - -#define PLL_LOCK_MASK BIT(31) -#define PLL_PD_MASK BIT(7) - -/* These are the specification limits for the SSCG PLL */ -#define PLL_REF_MIN_FREQ 25000000UL -#define PLL_REF_MAX_FREQ 235000000UL - -#define PLL_STAGE1_MIN_FREQ 1600000000UL -#define PLL_STAGE1_MAX_FREQ 2400000000UL - -#define PLL_STAGE1_REF_MIN_FREQ 25000000UL -#define PLL_STAGE1_REF_MAX_FREQ 54000000UL - -#define PLL_STAGE2_MIN_FREQ 1200000000UL -#define PLL_STAGE2_MAX_FREQ 2400000000UL - -#define PLL_STAGE2_REF_MIN_FREQ 54000000UL -#define PLL_STAGE2_REF_MAX_FREQ 75000000UL - -#define PLL_OUT_MIN_FREQ 20000000UL -#define PLL_OUT_MAX_FREQ 1200000000UL - -#define PLL_DIVR1_MAX 7 -#define PLL_DIVR2_MAX 63 -#define PLL_DIVF1_MAX 63 -#define PLL_DIVF2_MAX 63 -#define PLL_DIVQ_MAX 63 - -#define PLL_BYPASS_NONE 0x0 -#define PLL_BYPASS1 0x2 -#define PLL_BYPASS2 0x1 - -#define SSCG_PLL_BYPASS1_MASK BIT(5) -#define SSCG_PLL_BYPASS2_MASK BIT(4) -#define SSCG_PLL_BYPASS_MASK GENMASK(5, 4) - -#define PLL_SCCG_LOCK_TIMEOUT 70 - -struct clk_sccg_pll_setup { - int divr1, divf1; - int divr2, divf2; - int divq; - int bypass; - - uint64_t vco1; - uint64_t vco2; - uint64_t fout; - uint64_t ref; - uint64_t ref_div1; - uint64_t ref_div2; - uint64_t fout_request; - int fout_error; -}; - -struct clk_sccg_pll { - struct clk_hw hw; - const struct clk_ops ops; - - void __iomem *base; - - struct clk_sccg_pll_setup setup; - - u8 parent; - u8 bypass1; - u8 bypass2; -}; - -#define to_clk_sccg_pll(_hw) container_of(_hw, struct clk_sccg_pll, hw) - -static int clk_sccg_pll_wait_lock(struct clk_sccg_pll *pll) -{ - u32 val; - - val = readl_relaxed(pll->base + PLL_CFG0); - - /* don't wait for lock if all plls are bypassed */ - if (!(val & SSCG_PLL_BYPASS2_MASK)) - return readl_poll_timeout(pll->base, val, val & PLL_LOCK_MASK, - 0, PLL_SCCG_LOCK_TIMEOUT); - - return 0; -} - -static int clk_sccg_pll2_check_match(struct clk_sccg_pll_setup *setup, - struct clk_sccg_pll_setup *temp_setup) -{ - int new_diff = temp_setup->fout - temp_setup->fout_request; - int diff = temp_setup->fout_error; - - if (abs(diff) > abs(new_diff)) { - temp_setup->fout_error = new_diff; - memcpy(setup, temp_setup, sizeof(struct clk_sccg_pll_setup)); - - if (temp_setup->fout_request == temp_setup->fout) - return 0; - } - return -1; -} - -static int clk_sccg_divq_lookup(struct clk_sccg_pll_setup *setup, - struct clk_sccg_pll_setup *temp_setup) -{ - int ret = -EINVAL; - - for (temp_setup->divq = 0; temp_setup->divq <= PLL_DIVQ_MAX; - temp_setup->divq++) { - temp_setup->vco2 = temp_setup->vco1; - do_div(temp_setup->vco2, temp_setup->divr2 + 1); - temp_setup->vco2 *= 2; - temp_setup->vco2 *= temp_setup->divf2 + 1; - if (temp_setup->vco2 >= PLL_STAGE2_MIN_FREQ && - temp_setup->vco2 <= PLL_STAGE2_MAX_FREQ) { - temp_setup->fout = temp_setup->vco2; - do_div(temp_setup->fout, 2 * (temp_setup->divq + 1)); - - ret = clk_sccg_pll2_check_match(setup, temp_setup); - if (!ret) { - temp_setup->bypass = PLL_BYPASS1; - return ret; - } - } - } - - return ret; -} - -static int clk_sccg_divf2_lookup(struct clk_sccg_pll_setup *setup, - struct clk_sccg_pll_setup *temp_setup) -{ - int ret = -EINVAL; - - for (temp_setup->divf2 = 0; temp_setup->divf2 <= PLL_DIVF2_MAX; - temp_setup->divf2++) { - ret = clk_sccg_divq_lookup(setup, temp_setup); - if (!ret) - return ret; - } - - return ret; -} - -static int clk_sccg_divr2_lookup(struct clk_sccg_pll_setup *setup, - struct clk_sccg_pll_setup *temp_setup) -{ - int ret = -EINVAL; - - for (temp_setup->divr2 = 0; temp_setup->divr2 <= PLL_DIVR2_MAX; - temp_setup->divr2++) { - temp_setup->ref_div2 = temp_setup->vco1; - do_div(temp_setup->ref_div2, temp_setup->divr2 + 1); - if (temp_setup->ref_div2 >= PLL_STAGE2_REF_MIN_FREQ && - temp_setup->ref_div2 <= PLL_STAGE2_REF_MAX_FREQ) { - ret = clk_sccg_divf2_lookup(setup, temp_setup); - if (!ret) - return ret; - } - } - - return ret; -} - -static int clk_sccg_pll2_find_setup(struct clk_sccg_pll_setup *setup, - struct clk_sccg_pll_setup *temp_setup, - uint64_t ref) -{ - - int ret = -EINVAL; - - if (ref < PLL_STAGE1_MIN_FREQ || ref > PLL_STAGE1_MAX_FREQ) - return ret; - - temp_setup->vco1 = ref; - - ret = clk_sccg_divr2_lookup(setup, temp_setup); - return ret; -} - -static int clk_sccg_divf1_lookup(struct clk_sccg_pll_setup *setup, - struct clk_sccg_pll_setup *temp_setup) -{ - int ret = -EINVAL; - - for (temp_setup->divf1 = 0; temp_setup->divf1 <= PLL_DIVF1_MAX; - temp_setup->divf1++) { - uint64_t vco1 = temp_setup->ref; - - do_div(vco1, temp_setup->divr1 + 1); - vco1 *= 2; - vco1 *= temp_setup->divf1 + 1; - - ret = clk_sccg_pll2_find_setup(setup, temp_setup, vco1); - if (!ret) { - temp_setup->bypass = PLL_BYPASS_NONE; - return ret; - } - } - - return ret; -} - -static int clk_sccg_divr1_lookup(struct clk_sccg_pll_setup *setup, - struct clk_sccg_pll_setup *temp_setup) -{ - int ret = -EINVAL; - - for (temp_setup->divr1 = 0; temp_setup->divr1 <= PLL_DIVR1_MAX; - temp_setup->divr1++) { - temp_setup->ref_div1 = temp_setup->ref; - do_div(temp_setup->ref_div1, temp_setup->divr1 + 1); - if (temp_setup->ref_div1 >= PLL_STAGE1_REF_MIN_FREQ && - temp_setup->ref_div1 <= PLL_STAGE1_REF_MAX_FREQ) { - ret = clk_sccg_divf1_lookup(setup, temp_setup); - if (!ret) - return ret; - } - } - - return ret; -} - -static int clk_sccg_pll1_find_setup(struct clk_sccg_pll_setup *setup, - struct clk_sccg_pll_setup *temp_setup, - uint64_t ref) -{ - - int ret = -EINVAL; - - if (ref < PLL_REF_MIN_FREQ || ref > PLL_REF_MAX_FREQ) - return ret; - - temp_setup->ref = ref; - - ret = clk_sccg_divr1_lookup(setup, temp_setup); - - return ret; -} - -static int clk_sccg_pll_find_setup(struct clk_sccg_pll_setup *setup, - uint64_t prate, - uint64_t rate, int try_bypass) -{ - struct clk_sccg_pll_setup temp_setup; - int ret = -EINVAL; - - memset(&temp_setup, 0, sizeof(struct clk_sccg_pll_setup)); - memset(setup, 0, sizeof(struct clk_sccg_pll_setup)); - - temp_setup.fout_error = PLL_OUT_MAX_FREQ; - temp_setup.fout_request = rate; - - switch (try_bypass) { - - case PLL_BYPASS2: - if (prate == rate) { - setup->bypass = PLL_BYPASS2; - setup->fout = rate; - ret = 0; - } - break; - - case PLL_BYPASS1: - ret = clk_sccg_pll2_find_setup(setup, &temp_setup, prate); - break; - - case PLL_BYPASS_NONE: - ret = clk_sccg_pll1_find_setup(setup, &temp_setup, prate); - break; - } - - return ret; -} - - -static int clk_sccg_pll_is_prepared(struct clk_hw *hw) -{ - struct clk_sccg_pll *pll = to_clk_sccg_pll(hw); - - u32 val = readl_relaxed(pll->base + PLL_CFG0); - - return (val & PLL_PD_MASK) ? 0 : 1; -} - -static int clk_sccg_pll_prepare(struct clk_hw *hw) -{ - struct clk_sccg_pll *pll = to_clk_sccg_pll(hw); - u32 val; - - val = readl_relaxed(pll->base + PLL_CFG0); - val &= ~PLL_PD_MASK; - writel_relaxed(val, pll->base + PLL_CFG0); - - return clk_sccg_pll_wait_lock(pll); -} - -static void clk_sccg_pll_unprepare(struct clk_hw *hw) -{ - struct clk_sccg_pll *pll = to_clk_sccg_pll(hw); - u32 val; - - val = readl_relaxed(pll->base + PLL_CFG0); - val |= PLL_PD_MASK; - writel_relaxed(val, pll->base + PLL_CFG0); -} - -static unsigned long clk_sccg_pll_recalc_rate(struct clk_hw *hw, - unsigned long parent_rate) -{ - struct clk_sccg_pll *pll = to_clk_sccg_pll(hw); - u32 val, divr1, divf1, divr2, divf2, divq; - u64 temp64; - - val = readl_relaxed(pll->base + PLL_CFG2); - divr1 = FIELD_GET(PLL_DIVR1_MASK, val); - divr2 = FIELD_GET(PLL_DIVR2_MASK, val); - divf1 = FIELD_GET(PLL_DIVF1_MASK, val); - divf2 = FIELD_GET(PLL_DIVF2_MASK, val); - divq = FIELD_GET(PLL_DIVQ_MASK, val); - - temp64 = parent_rate; - - val = readl(pll->base + PLL_CFG0); - if (val & SSCG_PLL_BYPASS2_MASK) { - temp64 = parent_rate; - } else if (val & SSCG_PLL_BYPASS1_MASK) { - temp64 *= divf2; - do_div(temp64, (divr2 + 1) * (divq + 1)); - } else { - temp64 *= 2; - temp64 *= (divf1 + 1) * (divf2 + 1); - do_div(temp64, (divr1 + 1) * (divr2 + 1) * (divq + 1)); - } - - return temp64; -} - -static int clk_sccg_pll_set_rate(struct clk_hw *hw, unsigned long rate, - unsigned long parent_rate) -{ - struct clk_sccg_pll *pll = to_clk_sccg_pll(hw); - struct clk_sccg_pll_setup *setup = &pll->setup; - u32 val; - - /* set bypass here too since the parent might be the same */ - val = readl(pll->base + PLL_CFG0); - val &= ~SSCG_PLL_BYPASS_MASK; - val |= FIELD_PREP(SSCG_PLL_BYPASS_MASK, setup->bypass); - writel(val, pll->base + PLL_CFG0); - - val = readl_relaxed(pll->base + PLL_CFG2); - val &= ~(PLL_DIVF1_MASK | PLL_DIVF2_MASK); - val &= ~(PLL_DIVR1_MASK | PLL_DIVR2_MASK | PLL_DIVQ_MASK); - val |= FIELD_PREP(PLL_DIVF1_MASK, setup->divf1); - val |= FIELD_PREP(PLL_DIVF2_MASK, setup->divf2); - val |= FIELD_PREP(PLL_DIVR1_MASK, setup->divr1); - val |= FIELD_PREP(PLL_DIVR2_MASK, setup->divr2); - val |= FIELD_PREP(PLL_DIVQ_MASK, setup->divq); - writel_relaxed(val, pll->base + PLL_CFG2); - - return clk_sccg_pll_wait_lock(pll); -} - -static u8 clk_sccg_pll_get_parent(struct clk_hw *hw) -{ - struct clk_sccg_pll *pll = to_clk_sccg_pll(hw); - u32 val; - u8 ret = pll->parent; - - val = readl(pll->base + PLL_CFG0); - if (val & SSCG_PLL_BYPASS2_MASK) - ret = pll->bypass2; - else if (val & SSCG_PLL_BYPASS1_MASK) - ret = pll->bypass1; - return ret; -} - -static int clk_sccg_pll_set_parent(struct clk_hw *hw, u8 index) -{ - struct clk_sccg_pll *pll = to_clk_sccg_pll(hw); - u32 val; - - val = readl(pll->base + PLL_CFG0); - val &= ~SSCG_PLL_BYPASS_MASK; - val |= FIELD_PREP(SSCG_PLL_BYPASS_MASK, pll->setup.bypass); - writel(val, pll->base + PLL_CFG0); - - return clk_sccg_pll_wait_lock(pll); -} - -static int __clk_sccg_pll_determine_rate(struct clk_hw *hw, - struct clk_rate_request *req, - uint64_t min, - uint64_t max, - uint64_t rate, - int bypass) -{ - struct clk_sccg_pll *pll = to_clk_sccg_pll(hw); - struct clk_sccg_pll_setup *setup = &pll->setup; - struct clk_hw *parent_hw = NULL; - int bypass_parent_index; - int ret = -EINVAL; - - req->max_rate = max; - req->min_rate = min; - - switch (bypass) { - case PLL_BYPASS2: - bypass_parent_index = pll->bypass2; - break; - case PLL_BYPASS1: - bypass_parent_index = pll->bypass1; - break; - default: - bypass_parent_index = pll->parent; - break; - } - - parent_hw = clk_hw_get_parent_by_index(hw, bypass_parent_index); - ret = __clk_determine_rate(parent_hw, req); - if (!ret) { - ret = clk_sccg_pll_find_setup(setup, req->rate, - rate, bypass); - } - - req->best_parent_hw = parent_hw; - req->best_parent_rate = req->rate; - req->rate = setup->fout; - - return ret; -} - -static int clk_sccg_pll_determine_rate(struct clk_hw *hw, - struct clk_rate_request *req) -{ - struct clk_sccg_pll *pll = to_clk_sccg_pll(hw); - struct clk_sccg_pll_setup *setup = &pll->setup; - uint64_t rate = req->rate; - uint64_t min = req->min_rate; - uint64_t max = req->max_rate; - int ret = -EINVAL; - - if (rate < PLL_OUT_MIN_FREQ || rate > PLL_OUT_MAX_FREQ) - return ret; - - ret = __clk_sccg_pll_determine_rate(hw, req, req->rate, req->rate, - rate, PLL_BYPASS2); - if (!ret) - return ret; - - ret = __clk_sccg_pll_determine_rate(hw, req, PLL_STAGE1_REF_MIN_FREQ, - PLL_STAGE1_REF_MAX_FREQ, rate, - PLL_BYPASS1); - if (!ret) - return ret; - - ret = __clk_sccg_pll_determine_rate(hw, req, PLL_REF_MIN_FREQ, - PLL_REF_MAX_FREQ, rate, - PLL_BYPASS_NONE); - if (!ret) - return ret; - - if (setup->fout >= min && setup->fout <= max) - ret = 0; - - return ret; -} - -static const struct clk_ops clk_sccg_pll_ops = { - .prepare = clk_sccg_pll_prepare, - .unprepare = clk_sccg_pll_unprepare, - .is_prepared = clk_sccg_pll_is_prepared, - .recalc_rate = clk_sccg_pll_recalc_rate, - .set_rate = clk_sccg_pll_set_rate, - .set_parent = clk_sccg_pll_set_parent, - .get_parent = clk_sccg_pll_get_parent, - .determine_rate = clk_sccg_pll_determine_rate, -}; - -struct clk *imx_clk_sccg_pll(const char *name, - const char * const *parent_names, - u8 num_parents, - u8 parent, u8 bypass1, u8 bypass2, - void __iomem *base, - unsigned long flags) -{ - struct clk_sccg_pll *pll; - struct clk_init_data init; - struct clk_hw *hw; - int ret; - - pll = kzalloc(sizeof(*pll), GFP_KERNEL); - if (!pll) - return ERR_PTR(-ENOMEM); - - pll->parent = parent; - pll->bypass1 = bypass1; - pll->bypass2 = bypass2; - - pll->base = base; - init.name = name; - init.ops = &clk_sccg_pll_ops; - - init.flags = flags; - init.parent_names = parent_names; - init.num_parents = num_parents; - - pll->base = base; - pll->hw.init = &init; - - hw = &pll->hw; - - ret = clk_hw_register(NULL, hw); - if (ret) { - kfree(pll); - return ERR_PTR(ret); - } - - return hw->clk; -} diff --git a/drivers/clk/imx/clk-sscg-pll.c b/drivers/clk/imx/clk-sscg-pll.c new file mode 100644 index 00000000..0669e17 --- /dev/null +++ b/drivers/clk/imx/clk-sscg-pll.c @@ -0,0 +1,549 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright 2018 NXP. + * + * This driver supports the SCCG plls found in the imx8m SOCs + * + * Documentation for this SCCG pll can be found at: + * https://www.nxp.com/docs/en/reference-manual/IMX8MDQLQRM.pdf#page=834 + */ + +#include +#include +#include +#include +#include +#include + +#include "clk.h" + +/* PLL CFGs */ +#define PLL_CFG0 0x0 +#define PLL_CFG1 0x4 +#define PLL_CFG2 0x8 + +#define PLL_DIVF1_MASK GENMASK(18, 13) +#define PLL_DIVF2_MASK GENMASK(12, 7) +#define PLL_DIVR1_MASK GENMASK(27, 25) +#define PLL_DIVR2_MASK GENMASK(24, 19) +#define PLL_DIVQ_MASK GENMASK(6, 1) +#define PLL_REF_MASK GENMASK(2, 0) + +#define PLL_LOCK_MASK BIT(31) +#define PLL_PD_MASK BIT(7) + +/* These are the specification limits for the SSCG PLL */ +#define PLL_REF_MIN_FREQ 25000000UL +#define PLL_REF_MAX_FREQ 235000000UL + +#define PLL_STAGE1_MIN_FREQ 1600000000UL +#define PLL_STAGE1_MAX_FREQ 2400000000UL + +#define PLL_STAGE1_REF_MIN_FREQ 25000000UL +#define PLL_STAGE1_REF_MAX_FREQ 54000000UL + +#define PLL_STAGE2_MIN_FREQ 1200000000UL +#define PLL_STAGE2_MAX_FREQ 2400000000UL + +#define PLL_STAGE2_REF_MIN_FREQ 54000000UL +#define PLL_STAGE2_REF_MAX_FREQ 75000000UL + +#define PLL_OUT_MIN_FREQ 20000000UL +#define PLL_OUT_MAX_FREQ 1200000000UL + +#define PLL_DIVR1_MAX 7 +#define PLL_DIVR2_MAX 63 +#define PLL_DIVF1_MAX 63 +#define PLL_DIVF2_MAX 63 +#define PLL_DIVQ_MAX 63 + +#define PLL_BYPASS_NONE 0x0 +#define PLL_BYPASS1 0x2 +#define PLL_BYPASS2 0x1 + +#define SSCG_PLL_BYPASS1_MASK BIT(5) +#define SSCG_PLL_BYPASS2_MASK BIT(4) +#define SSCG_PLL_BYPASS_MASK GENMASK(5, 4) + +#define PLL_SCCG_LOCK_TIMEOUT 70 + +struct clk_sscg_pll_setup { + int divr1, divf1; + int divr2, divf2; + int divq; + int bypass; + + uint64_t vco1; + uint64_t vco2; + uint64_t fout; + uint64_t ref; + uint64_t ref_div1; + uint64_t ref_div2; + uint64_t fout_request; + int fout_error; +}; + +struct clk_sscg_pll { + struct clk_hw hw; + const struct clk_ops ops; + + void __iomem *base; + + struct clk_sscg_pll_setup setup; + + u8 parent; + u8 bypass1; + u8 bypass2; +}; + +#define to_clk_sscg_pll(_hw) container_of(_hw, struct clk_sscg_pll, hw) + +static int clk_sscg_pll_wait_lock(struct clk_sscg_pll *pll) +{ + u32 val; + + val = readl_relaxed(pll->base + PLL_CFG0); + + /* don't wait for lock if all plls are bypassed */ + if (!(val & SSCG_PLL_BYPASS2_MASK)) + return readl_poll_timeout(pll->base, val, val & PLL_LOCK_MASK, + 0, PLL_SCCG_LOCK_TIMEOUT); + + return 0; +} + +static int clk_sscg_pll2_check_match(struct clk_sscg_pll_setup *setup, + struct clk_sscg_pll_setup *temp_setup) +{ + int new_diff = temp_setup->fout - temp_setup->fout_request; + int diff = temp_setup->fout_error; + + if (abs(diff) > abs(new_diff)) { + temp_setup->fout_error = new_diff; + memcpy(setup, temp_setup, sizeof(struct clk_sscg_pll_setup)); + + if (temp_setup->fout_request == temp_setup->fout) + return 0; + } + return -1; +} + +static int clk_sscg_divq_lookup(struct clk_sscg_pll_setup *setup, + struct clk_sscg_pll_setup *temp_setup) +{ + int ret = -EINVAL; + + for (temp_setup->divq = 0; temp_setup->divq <= PLL_DIVQ_MAX; + temp_setup->divq++) { + temp_setup->vco2 = temp_setup->vco1; + do_div(temp_setup->vco2, temp_setup->divr2 + 1); + temp_setup->vco2 *= 2; + temp_setup->vco2 *= temp_setup->divf2 + 1; + if (temp_setup->vco2 >= PLL_STAGE2_MIN_FREQ && + temp_setup->vco2 <= PLL_STAGE2_MAX_FREQ) { + temp_setup->fout = temp_setup->vco2; + do_div(temp_setup->fout, 2 * (temp_setup->divq + 1)); + + ret = clk_sscg_pll2_check_match(setup, temp_setup); + if (!ret) { + temp_setup->bypass = PLL_BYPASS1; + return ret; + } + } + } + + return ret; +} + +static int clk_sscg_divf2_lookup(struct clk_sscg_pll_setup *setup, + struct clk_sscg_pll_setup *temp_setup) +{ + int ret = -EINVAL; + + for (temp_setup->divf2 = 0; temp_setup->divf2 <= PLL_DIVF2_MAX; + temp_setup->divf2++) { + ret = clk_sscg_divq_lookup(setup, temp_setup); + if (!ret) + return ret; + } + + return ret; +} + +static int clk_sscg_divr2_lookup(struct clk_sscg_pll_setup *setup, + struct clk_sscg_pll_setup *temp_setup) +{ + int ret = -EINVAL; + + for (temp_setup->divr2 = 0; temp_setup->divr2 <= PLL_DIVR2_MAX; + temp_setup->divr2++) { + temp_setup->ref_div2 = temp_setup->vco1; + do_div(temp_setup->ref_div2, temp_setup->divr2 + 1); + if (temp_setup->ref_div2 >= PLL_STAGE2_REF_MIN_FREQ && + temp_setup->ref_div2 <= PLL_STAGE2_REF_MAX_FREQ) { + ret = clk_sscg_divf2_lookup(setup, temp_setup); + if (!ret) + return ret; + } + } + + return ret; +} + +static int clk_sscg_pll2_find_setup(struct clk_sscg_pll_setup *setup, + struct clk_sscg_pll_setup *temp_setup, + uint64_t ref) +{ + + int ret = -EINVAL; + + if (ref < PLL_STAGE1_MIN_FREQ || ref > PLL_STAGE1_MAX_FREQ) + return ret; + + temp_setup->vco1 = ref; + + ret = clk_sscg_divr2_lookup(setup, temp_setup); + return ret; +} + +static int clk_sscg_divf1_lookup(struct clk_sscg_pll_setup *setup, + struct clk_sscg_pll_setup *temp_setup) +{ + int ret = -EINVAL; + + for (temp_setup->divf1 = 0; temp_setup->divf1 <= PLL_DIVF1_MAX; + temp_setup->divf1++) { + uint64_t vco1 = temp_setup->ref; + + do_div(vco1, temp_setup->divr1 + 1); + vco1 *= 2; + vco1 *= temp_setup->divf1 + 1; + + ret = clk_sscg_pll2_find_setup(setup, temp_setup, vco1); + if (!ret) { + temp_setup->bypass = PLL_BYPASS_NONE; + return ret; + } + } + + return ret; +} + +static int clk_sscg_divr1_lookup(struct clk_sscg_pll_setup *setup, + struct clk_sscg_pll_setup *temp_setup) +{ + int ret = -EINVAL; + + for (temp_setup->divr1 = 0; temp_setup->divr1 <= PLL_DIVR1_MAX; + temp_setup->divr1++) { + temp_setup->ref_div1 = temp_setup->ref; + do_div(temp_setup->ref_div1, temp_setup->divr1 + 1); + if (temp_setup->ref_div1 >= PLL_STAGE1_REF_MIN_FREQ && + temp_setup->ref_div1 <= PLL_STAGE1_REF_MAX_FREQ) { + ret = clk_sscg_divf1_lookup(setup, temp_setup); + if (!ret) + return ret; + } + } + + return ret; +} + +static int clk_sscg_pll1_find_setup(struct clk_sscg_pll_setup *setup, + struct clk_sscg_pll_setup *temp_setup, + uint64_t ref) +{ + + int ret = -EINVAL; + + if (ref < PLL_REF_MIN_FREQ || ref > PLL_REF_MAX_FREQ) + return ret; + + temp_setup->ref = ref; + + ret = clk_sscg_divr1_lookup(setup, temp_setup); + + return ret; +} + +static int clk_sscg_pll_find_setup(struct clk_sscg_pll_setup *setup, + uint64_t prate, + uint64_t rate, int try_bypass) +{ + struct clk_sscg_pll_setup temp_setup; + int ret = -EINVAL; + + memset(&temp_setup, 0, sizeof(struct clk_sscg_pll_setup)); + memset(setup, 0, sizeof(struct clk_sscg_pll_setup)); + + temp_setup.fout_error = PLL_OUT_MAX_FREQ; + temp_setup.fout_request = rate; + + switch (try_bypass) { + + case PLL_BYPASS2: + if (prate == rate) { + setup->bypass = PLL_BYPASS2; + setup->fout = rate; + ret = 0; + } + break; + + case PLL_BYPASS1: + ret = clk_sscg_pll2_find_setup(setup, &temp_setup, prate); + break; + + case PLL_BYPASS_NONE: + ret = clk_sscg_pll1_find_setup(setup, &temp_setup, prate); + break; + } + + return ret; +} + + +static int clk_sscg_pll_is_prepared(struct clk_hw *hw) +{ + struct clk_sscg_pll *pll = to_clk_sscg_pll(hw); + + u32 val = readl_relaxed(pll->base + PLL_CFG0); + + return (val & PLL_PD_MASK) ? 0 : 1; +} + +static int clk_sscg_pll_prepare(struct clk_hw *hw) +{ + struct clk_sscg_pll *pll = to_clk_sscg_pll(hw); + u32 val; + + val = readl_relaxed(pll->base + PLL_CFG0); + val &= ~PLL_PD_MASK; + writel_relaxed(val, pll->base + PLL_CFG0); + + return clk_sscg_pll_wait_lock(pll); +} + +static void clk_sscg_pll_unprepare(struct clk_hw *hw) +{ + struct clk_sscg_pll *pll = to_clk_sscg_pll(hw); + u32 val; + + val = readl_relaxed(pll->base + PLL_CFG0); + val |= PLL_PD_MASK; + writel_relaxed(val, pll->base + PLL_CFG0); +} + +static unsigned long clk_sscg_pll_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct clk_sscg_pll *pll = to_clk_sscg_pll(hw); + u32 val, divr1, divf1, divr2, divf2, divq; + u64 temp64; + + val = readl_relaxed(pll->base + PLL_CFG2); + divr1 = FIELD_GET(PLL_DIVR1_MASK, val); + divr2 = FIELD_GET(PLL_DIVR2_MASK, val); + divf1 = FIELD_GET(PLL_DIVF1_MASK, val); + divf2 = FIELD_GET(PLL_DIVF2_MASK, val); + divq = FIELD_GET(PLL_DIVQ_MASK, val); + + temp64 = parent_rate; + + val = readl(pll->base + PLL_CFG0); + if (val & SSCG_PLL_BYPASS2_MASK) { + temp64 = parent_rate; + } else if (val & SSCG_PLL_BYPASS1_MASK) { + temp64 *= divf2; + do_div(temp64, (divr2 + 1) * (divq + 1)); + } else { + temp64 *= 2; + temp64 *= (divf1 + 1) * (divf2 + 1); + do_div(temp64, (divr1 + 1) * (divr2 + 1) * (divq + 1)); + } + + return temp64; +} + +static int clk_sscg_pll_set_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) +{ + struct clk_sscg_pll *pll = to_clk_sscg_pll(hw); + struct clk_sscg_pll_setup *setup = &pll->setup; + u32 val; + + /* set bypass here too since the parent might be the same */ + val = readl(pll->base + PLL_CFG0); + val &= ~SSCG_PLL_BYPASS_MASK; + val |= FIELD_PREP(SSCG_PLL_BYPASS_MASK, setup->bypass); + writel(val, pll->base + PLL_CFG0); + + val = readl_relaxed(pll->base + PLL_CFG2); + val &= ~(PLL_DIVF1_MASK | PLL_DIVF2_MASK); + val &= ~(PLL_DIVR1_MASK | PLL_DIVR2_MASK | PLL_DIVQ_MASK); + val |= FIELD_PREP(PLL_DIVF1_MASK, setup->divf1); + val |= FIELD_PREP(PLL_DIVF2_MASK, setup->divf2); + val |= FIELD_PREP(PLL_DIVR1_MASK, setup->divr1); + val |= FIELD_PREP(PLL_DIVR2_MASK, setup->divr2); + val |= FIELD_PREP(PLL_DIVQ_MASK, setup->divq); + writel_relaxed(val, pll->base + PLL_CFG2); + + return clk_sscg_pll_wait_lock(pll); +} + +static u8 clk_sscg_pll_get_parent(struct clk_hw *hw) +{ + struct clk_sscg_pll *pll = to_clk_sscg_pll(hw); + u32 val; + u8 ret = pll->parent; + + val = readl(pll->base + PLL_CFG0); + if (val & SSCG_PLL_BYPASS2_MASK) + ret = pll->bypass2; + else if (val & SSCG_PLL_BYPASS1_MASK) + ret = pll->bypass1; + return ret; +} + +static int clk_sscg_pll_set_parent(struct clk_hw *hw, u8 index) +{ + struct clk_sscg_pll *pll = to_clk_sscg_pll(hw); + u32 val; + + val = readl(pll->base + PLL_CFG0); + val &= ~SSCG_PLL_BYPASS_MASK; + val |= FIELD_PREP(SSCG_PLL_BYPASS_MASK, pll->setup.bypass); + writel(val, pll->base + PLL_CFG0); + + return clk_sscg_pll_wait_lock(pll); +} + +static int __clk_sscg_pll_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req, + uint64_t min, + uint64_t max, + uint64_t rate, + int bypass) +{ + struct clk_sscg_pll *pll = to_clk_sscg_pll(hw); + struct clk_sscg_pll_setup *setup = &pll->setup; + struct clk_hw *parent_hw = NULL; + int bypass_parent_index; + int ret = -EINVAL; + + req->max_rate = max; + req->min_rate = min; + + switch (bypass) { + case PLL_BYPASS2: + bypass_parent_index = pll->bypass2; + break; + case PLL_BYPASS1: + bypass_parent_index = pll->bypass1; + break; + default: + bypass_parent_index = pll->parent; + break; + } + + parent_hw = clk_hw_get_parent_by_index(hw, bypass_parent_index); + ret = __clk_determine_rate(parent_hw, req); + if (!ret) { + ret = clk_sscg_pll_find_setup(setup, req->rate, + rate, bypass); + } + + req->best_parent_hw = parent_hw; + req->best_parent_rate = req->rate; + req->rate = setup->fout; + + return ret; +} + +static int clk_sscg_pll_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + struct clk_sscg_pll *pll = to_clk_sscg_pll(hw); + struct clk_sscg_pll_setup *setup = &pll->setup; + uint64_t rate = req->rate; + uint64_t min = req->min_rate; + uint64_t max = req->max_rate; + int ret = -EINVAL; + + if (rate < PLL_OUT_MIN_FREQ || rate > PLL_OUT_MAX_FREQ) + return ret; + + ret = __clk_sscg_pll_determine_rate(hw, req, req->rate, req->rate, + rate, PLL_BYPASS2); + if (!ret) + return ret; + + ret = __clk_sscg_pll_determine_rate(hw, req, PLL_STAGE1_REF_MIN_FREQ, + PLL_STAGE1_REF_MAX_FREQ, rate, + PLL_BYPASS1); + if (!ret) + return ret; + + ret = __clk_sscg_pll_determine_rate(hw, req, PLL_REF_MIN_FREQ, + PLL_REF_MAX_FREQ, rate, + PLL_BYPASS_NONE); + if (!ret) + return ret; + + if (setup->fout >= min && setup->fout <= max) + ret = 0; + + return ret; +} + +static const struct clk_ops clk_sscg_pll_ops = { + .prepare = clk_sscg_pll_prepare, + .unprepare = clk_sscg_pll_unprepare, + .is_prepared = clk_sscg_pll_is_prepared, + .recalc_rate = clk_sscg_pll_recalc_rate, + .set_rate = clk_sscg_pll_set_rate, + .set_parent = clk_sscg_pll_set_parent, + .get_parent = clk_sscg_pll_get_parent, + .determine_rate = clk_sscg_pll_determine_rate, +}; + +struct clk *imx_clk_sscg_pll(const char *name, + const char * const *parent_names, + u8 num_parents, + u8 parent, u8 bypass1, u8 bypass2, + void __iomem *base, + unsigned long flags) +{ + struct clk_sscg_pll *pll; + struct clk_init_data init; + struct clk_hw *hw; + int ret; + + pll = kzalloc(sizeof(*pll), GFP_KERNEL); + if (!pll) + return ERR_PTR(-ENOMEM); + + pll->parent = parent; + pll->bypass1 = bypass1; + pll->bypass2 = bypass2; + + pll->base = base; + init.name = name; + init.ops = &clk_sscg_pll_ops; + + init.flags = flags; + init.parent_names = parent_names; + init.num_parents = num_parents; + + pll->base = base; + pll->hw.init = &init; + + hw = &pll->hw; + + ret = clk_hw_register(NULL, hw); + if (ret) { + kfree(pll); + return ERR_PTR(ret); + } + + return hw->clk; +} diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 30ddbc1..9330632 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -24,7 +24,7 @@ enum imx_pllv1_type { IMX_PLLV1_IMX35, }; -enum imx_sccg_pll_type { +enum imx_sscg_pll_type { SCCG_PLL1, SCCG_PLL2, }; @@ -109,7 +109,7 @@ struct clk *imx_clk_pllv2(const char *name, const char *parent, struct clk *imx_clk_frac_pll(const char *name, const char *parent_name, void __iomem *base); -struct clk *imx_clk_sccg_pll(const char *name, +struct clk *imx_clk_sscg_pll(const char *name, const char * const *parent_names, u8 num_parents, u8 parent, u8 bypass1, u8 bypass2, From patchwork Fri Nov 22 10:48:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11257805 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0949A109A for ; Fri, 22 Nov 2019 11:18:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D3F412075B for ; Fri, 22 Nov 2019 11:18:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="QHgRJ8NZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729518AbfKVLSE (ORCPT ); Fri, 22 Nov 2019 06:18:04 -0500 Received: from mail-eopbgr20045.outbound.protection.outlook.com ([40.107.2.45]:34373 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728288AbfKVKsY (ORCPT ); Fri, 22 Nov 2019 05:48:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dr8mcAnNfYTsTHeMI0xrxzNS/lHSOV1VfCFd9Kf+RC0FwMDhadxk68spsgouB0hlPM7WKwHa7ln+hNg2WBdsVJF/Pjc8xQU+gj7sWQ24FjpDNfO7CLjAxC5E6jS4yd9LtNdsRmfQqKgJWnj7+mHWxvHipa2H9hQ/6QcDXtpX24QQXMfELqCSF1o+5S0zoF6WOG5N6NEMnQLThC+DE032VnnkKS3xGWRWXL23lXYg3hG5gO3RDEfLdr+exfQC36J3qZwMQ9F/owtw6Sb5W5d5BKS2n/7gGRgzjv/XdgnZ4FoS2COInMs6Pt+3FBpgHezP6sItX/HG2ZQDuSX/Fd15uQ== 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=un1i3gNue6RKakpZXjbAvTO4R81IjhwJPhyb/Fpc08g=; b=mTIxW3X1jZSiH99J+yX83jyE3wX1OXSG6pFqz0cxIO1BehVwAcsWe988NTkrjqqUqlSXPNEjEXwtEOaKUCYJXFjwxSpRIn3K1qiFNrlXcslKJx1hoJGV8lMpDevxuNnxwhcPzIjHiWbXada3uQ44q23eRyTiceIpuLkaxM6h/6nvjuVGL0vVEu/FD/d4VcyMk8IDdy4oj/yrL00bRYjzCbgWRnO3qWXJYTqG7dgpgb2rDOtB6dRPAUANXQJWHlDfZXYRc0ZIOfTVrKZzJzJppTcR7x6JMW1UY5iXnXhzNbHQ0CfJK/YGWx+RCV9PMo+Pr5SNfkE46XZXka7qNTuKDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=un1i3gNue6RKakpZXjbAvTO4R81IjhwJPhyb/Fpc08g=; b=QHgRJ8NZyHxHCJ+lhxdW8t6TUNAZ2q5xKg7Q4u7+XJSvo6P0NJzQ9kn7aiY/HJkix0WtKTsem6eIpfr9TTDQxZmCT1J6E14DJB3+Qr65YRpitaF7eTJTXlL4P/Zmq70ERA9Y051A3JfbHEoXyoDFZZPz8pxG7RtScGgXiHyx9P8= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB5074.eurprd04.prod.outlook.com (20.177.42.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 10:48:14 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde%7]) with mapi id 15.20.2474.019; Fri, 22 Nov 2019 10:48:13 +0000 From: Abel Vesa To: Aisheng Dong , Shawn Guo , Leonard Crestez , Stephen Boyd , Sascha Hauer , Jacky Bai CC: Peng Fan , dl-linux-imx , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Abel Vesa Subject: [PATCH v2 03/11] clk: imx: Replace all the clk based helpers with macros Thread-Topic: [PATCH v2 03/11] clk: imx: Replace all the clk based helpers with macros Thread-Index: AQHVoSJWy75DOhHmpkOy2/m972l94w== Date: Fri, 22 Nov 2019 10:48:13 +0000 Message-ID: <1574419679-3813-4-git-send-email-abel.vesa@nxp.com> References: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:208:15::33) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.7.4 authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: f526b208-06be-48d8-d0ed-08d76f3978ee x-ms-traffictypediagnostic: AM0PR04MB5074:|AM0PR04MB5074: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 02296943FF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(346002)(376002)(396003)(136003)(189003)(199004)(478600001)(14444005)(256004)(6506007)(54906003)(7736002)(305945005)(316002)(71200400001)(5660300002)(110136005)(102836004)(186003)(86362001)(66066001)(71190400001)(2906002)(4326008)(76176011)(99286004)(36756003)(26005)(52116002)(386003)(8936002)(3846002)(2616005)(446003)(44832011)(11346002)(66556008)(66476007)(66446008)(64756008)(6486002)(66946007)(6436002)(81166006)(8676002)(81156014)(6636002)(6512007)(25786009)(14454004)(50226002)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB5074;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: x5jcNx0D+v9v5j8utzEbjUz3ZG6Z0/H7V5kJnFRMVxDwf78WMvqk89Z8b0CjwzrJeHpPAvGxBK6W5W5qI5wLADGJiTNRTQp79R0o+zsClFftOZbYr3xYV24SAXM3HdzAShGy8HO2f5Ak/6YgLj6kv8s1EDwXbkNuUXCUTtrqJzAU+uoMh2K/Qgj5PYLfnaGroEyQw6wh5XXw7jwyV1s3LX4s9OOLUkvq/fHYO1sddz2Af67ymzraQYfnkD0mn6DM04yH/hjyWtGC/h/QmEdDYdTKUq9wjVmfleqwjDDg1/1gk0g3+gpEh1zbCZSiK73Gs3hrIB+DvqJrpiEwp6wBzdsYQhD+pHMVzWhA6NzxhQES1Knsx0gY6gev1aGprxxSE6UG8ltomBho+YOsUUW5yEtdRyt2RwHggQy6qLncRorOr5drPQ5THV7qw8aKsU+m MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f526b208-06be-48d8-d0ed-08d76f3978ee X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2019 10:48:13.0589 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: anDvX0+G8cNbG6I3nA20WsSiQTp5lBc4MVX8OPYRUn08lTJ1CY2HbmbGr5CghYkvRbv64kk9YwBqtL9CWb9T4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5074 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Replacing with macros all the clk based API helpers we reduce the code duplication. The end goal is to get rid of all these macros when there will be no more users of the clk based API, that is, when all the i.MX clock provider drivers will be switched completely to the clk_hw based API. This is another step in moving away from the non clk_hw based API usage throughout the i.MX clock drivers. The reason for doing that is to have a clear split between the clock provider and the clock consumer API. Signed-off-by: Abel Vesa Reviewed-by: Peng Fan --- drivers/clk/imx/clk.h | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 9330632..3ed17a1 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -70,12 +70,24 @@ extern struct imx_pll14xx_clk imx_1443x_pll; #define imx_clk_gate_exclusive(name, parent, reg, shift, exclusive_mask) \ to_clk(imx_clk_hw_gate_exclusive(name, parent, reg, shift, exclusive_mask)) +#define imx_clk_fixed(name, rate) \ + to_clk(imx_clk_hw_fixed(name, rate)) + #define imx_clk_fixed_factor(name, parent, mult, div) \ to_clk(imx_clk_hw_fixed_factor(name, parent, mult, div)) +#define imx_clk_divider(name, parent, reg, shift, width) \ + to_clk(imx_clk_hw_divider(name, parent, reg, shift, width)) + #define imx_clk_divider2(name, parent, reg, shift, width) \ to_clk(imx_clk_hw_divider2(name, parent, reg, shift, width)) +#define imx_clk_divider_flags(name, parent, reg, shift, width, flags) \ + to_clk(imx_clk_hw_divider_flags(name, parent, reg, shift, width, flags)) + +#define imx_clk_gate(name, parent, reg, shift) \ + to_clk(imx_clk_hw_gate(name, parent, reg, shift)) + #define imx_clk_gate_dis(name, parent, reg, shift) \ to_clk(imx_clk_hw_gate_dis(name, parent, reg, shift)) @@ -205,11 +217,6 @@ static inline struct clk *to_clk(struct clk_hw *hw) return hw->clk; } -static inline struct clk *imx_clk_fixed(const char *name, int rate) -{ - return clk_register_fixed_rate(NULL, name, NULL, 0, rate); -} - static inline struct clk_hw *imx_clk_hw_fixed(const char *name, int rate) { return clk_hw_register_fixed_rate(NULL, name, NULL, 0, rate); @@ -231,13 +238,6 @@ static inline struct clk_hw *imx_clk_hw_fixed_factor(const char *name, CLK_SET_RATE_PARENT, mult, div); } -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, - reg, shift, width, 0, &imx_ccm_lock); -} - static inline struct clk_hw *imx_clk_hw_divider(const char *name, const char *parent, void __iomem *reg, u8 shift, @@ -247,14 +247,6 @@ static inline struct clk_hw *imx_clk_hw_divider(const char *name, reg, shift, width, 0, &imx_ccm_lock); } -static inline struct clk *imx_clk_divider_flags(const char *name, - const char *parent, void __iomem *reg, u8 shift, u8 width, - unsigned long flags) -{ - return clk_register_divider(NULL, name, parent, flags, - reg, shift, width, 0, &imx_ccm_lock); -} - static inline struct clk_hw *imx_clk_hw_divider_flags(const char *name, const char *parent, void __iomem *reg, u8 shift, @@ -281,13 +273,6 @@ static inline struct clk *imx_clk_divider2_flags(const char *name, reg, shift, width, 0, &imx_ccm_lock); } -static inline struct clk *imx_clk_gate(const char *name, const char *parent, - void __iomem *reg, u8 shift) -{ - return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg, - shift, 0, &imx_ccm_lock); -} - static inline struct clk_hw *imx_clk_hw_gate_flags(const char *name, const char *parent, void __iomem *reg, u8 shift, unsigned long flags) { From patchwork Fri Nov 22 10:48:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11257799 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7B4DB109A for ; Fri, 22 Nov 2019 11:17:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 524582077B for ; Fri, 22 Nov 2019 11:17:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="B26G/BPX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729472AbfKVKs2 (ORCPT ); Fri, 22 Nov 2019 05:48:28 -0500 Received: from mail-eopbgr20045.outbound.protection.outlook.com ([40.107.2.45]:34373 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729922AbfKVKs1 (ORCPT ); Fri, 22 Nov 2019 05:48:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N+alRPxoEcGqA5Vo00h5dyJbvBQZqPA392MDwoVMgIh+kao9YUM/gJU0QOfo910kfihhZLVQdLSZoIGTKJwEXALtheaKlHuBV0Ojtq1XFLGgkh6kxJtK9MC4u1ULPuEti+gdn4iXsPY6hHXCx01EhehxrGGJ04buLTNGyyoV4jSUpWapYMNGiy1E2orOpdGqORLONVhagu5eeuu0C8Ee7n1yr8ecVUx71CxGJW1GKyH+UmSyAY7zwgqZELz1LJ/mT7whjuG7I9J2hT+DAKcfDSm7VkXKoT/M4SkZFunP/WZl/WQoG7/R5WPNPwtGv2MC7VUawIXH/9mD7+xTPvaiLw== 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=qjpNt3BKobqblXOtBaq8pdvK3XqmVPORcjlWWWAh5Rc=; b=iKoc3e8j8GJj7Viw8A/XsmVfaNTyg9e0gTFiFuNWlNPkF0DaRBOEM/E6ar1W/A9/qSLLanhaC0p6WNya8ED1GSSAclS+xRxEDE7s9zc665xzckTEYvqro+Ovw3vXptp6Cys85+PZ8LP0MfclWesOYemuYHo+pRD/mpHQH0Wo65CYZuD/gmymURbDIel8ogQtYBfDh/zO942SIRKKfyjPx7g5RB1wl44TSb4cyg5k8RW7oR8MuQ9Y2hzwpSh47VjmP4iTHnVtC4pSQ8bKK9kuew6+m2LUATJLD4xrYlrpJp/dtMb8nMh8d5JsoViDPo4XO4P2H0vEv8KRbHA8M98tFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qjpNt3BKobqblXOtBaq8pdvK3XqmVPORcjlWWWAh5Rc=; b=B26G/BPX47IXXMNpFTNiea5/Gt057Kn5G3j6KarvgMIeF/ITqffjw4Jdmyk0IzbMNlvYGUAoavNvxixZziar9hjidhAFuKbPOji15Y+ytPjOGXKpgWoFaNfdjdAIcmbenGmdBkDhKP9oF6o2+hu7TQwKI5TZ0XwXIOe4qpfPoOY= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB5074.eurprd04.prod.outlook.com (20.177.42.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 10:48:14 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde%7]) with mapi id 15.20.2474.019; Fri, 22 Nov 2019 10:48:14 +0000 From: Abel Vesa To: Aisheng Dong , Shawn Guo , Leonard Crestez , Stephen Boyd , Sascha Hauer , Jacky Bai CC: Peng Fan , dl-linux-imx , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Abel Vesa Subject: [PATCH v2 04/11] clk: imx: pllv1: Switch to clk_hw based API Thread-Topic: [PATCH v2 04/11] clk: imx: pllv1: Switch to clk_hw based API Thread-Index: AQHVoSJXY0stcOmqOE+UvoibgGHUaQ== Date: Fri, 22 Nov 2019 10:48:13 +0000 Message-ID: <1574419679-3813-5-git-send-email-abel.vesa@nxp.com> References: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:208:15::33) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.7.4 authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 982772e9-97d8-4925-07d6-08d76f39797c x-ms-traffictypediagnostic: AM0PR04MB5074:|AM0PR04MB5074: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2657; x-forefront-prvs: 02296943FF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(346002)(376002)(396003)(136003)(189003)(199004)(478600001)(256004)(6506007)(54906003)(7736002)(305945005)(316002)(71200400001)(5660300002)(110136005)(102836004)(186003)(86362001)(66066001)(71190400001)(2906002)(4326008)(76176011)(99286004)(36756003)(26005)(52116002)(386003)(8936002)(3846002)(2616005)(446003)(44832011)(11346002)(66556008)(66476007)(66446008)(64756008)(6486002)(66946007)(6436002)(81166006)(8676002)(81156014)(6636002)(6512007)(25786009)(14454004)(50226002)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB5074;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lPdSnzOEUo3of75HJggUUlW4XnpK87N49wpoZsy/A5c1eNY2z5cLzllU9E5pBfN0XNDW2i6f/vBDCwWiWDfxLphsTYAdUGYeRdaz1PkqocPk3wsxVfSBQ1k8BVNJ+eJkx18tMd8/s2BrDP9ZBOQ9jFxrXUslkbsLVmk5YPGDLK7AU/xZS+sjYpJq4iw90dHqKnK/S0z8RhYNhvXGIXOOG+GtUXtij/gIZC3CeFUFHaXzyIGF73av3SN6PA+4sYS9+gjGjoED9+9ToqGlND2zY6kUKgg23ogde4s3sM8kzlyPG2dB/TrF16Nyf62HG1dBqXaCdbGOj7yd7lhQrdENDIfikKYG7LpAY0lyP670o3+BcfO0H+Ui5dPyjEfUTyW2nkc5DRzhD3dKqIjCSLyJ4INH14YhuxQZLNjBk09XJs9zRFKeZdPPVW96t36PPNCD MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 982772e9-97d8-4925-07d6-08d76f39797c X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2019 10:48:13.9604 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 7hMArpO0L/3Vh+x+H0DkTw5iWlDJ4pKn6gWt70uiwPocKOvk7j3GBhFpIKMpVxt5529s+cxg+xLfuHBSIWxirg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5074 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Switch the imx_clk_pllv1 register function to clk_hw based API, rename accordingly and add a macro for clk based legacy. This allows us to move closer to a clear split between consumer and provider clk APIs. Signed-off-by: Abel Vesa Reviewed-by: Peng Fan --- drivers/clk/imx/clk-pllv1.c | 14 +++++++++----- drivers/clk/imx/clk.h | 5 ++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/clk/imx/clk-pllv1.c b/drivers/clk/imx/clk-pllv1.c index 4ba9973..de4f8a4 100644 --- a/drivers/clk/imx/clk-pllv1.c +++ b/drivers/clk/imx/clk-pllv1.c @@ -111,12 +111,13 @@ static const struct clk_ops clk_pllv1_ops = { .recalc_rate = clk_pllv1_recalc_rate, }; -struct clk *imx_clk_pllv1(enum imx_pllv1_type type, const char *name, +struct clk_hw *imx_clk_hw_pllv1(enum imx_pllv1_type type, const char *name, const char *parent, void __iomem *base) { struct clk_pllv1 *pll; - struct clk *clk; + struct clk_hw *hw; struct clk_init_data init; + int ret; pll = kmalloc(sizeof(*pll), GFP_KERNEL); if (!pll) @@ -132,10 +133,13 @@ struct clk *imx_clk_pllv1(enum imx_pllv1_type type, const char *name, init.num_parents = 1; pll->hw.init = &init; + hw = &pll->hw; - clk = clk_register(NULL, &pll->hw); - if (IS_ERR(clk)) + ret = clk_hw_register(NULL, hw); + if (ret) { kfree(pll); + return ERR_PTR(ret); + } - return clk; + return hw; } diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 3ed17a1..bd6a592 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -109,10 +109,13 @@ extern struct imx_pll14xx_clk imx_1443x_pll; #define imx_clk_mux(name, reg, shift, width, parents, num_parents) \ to_clk(imx_clk_hw_mux(name, reg, shift, width, parents, num_parents)) +#define imx_clk_pllv1(type, name, parent, base) \ + to_clk(imx_clk_hw_pllv1(type, name, parent, base)) + struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, void __iomem *base, const struct imx_pll14xx_clk *pll_clk); -struct clk *imx_clk_pllv1(enum imx_pllv1_type type, const char *name, +struct clk_hw *imx_clk_hw_pllv1(enum imx_pllv1_type type, const char *name, const char *parent, void __iomem *base); struct clk *imx_clk_pllv2(const char *name, const char *parent, From patchwork Fri Nov 22 10:48:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11257801 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A41141593 for ; Fri, 22 Nov 2019 11:17:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8438A20718 for ; Fri, 22 Nov 2019 11:17:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="HjBq0jeZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729943AbfKVKs2 (ORCPT ); Fri, 22 Nov 2019 05:48:28 -0500 Received: from mail-eopbgr70054.outbound.protection.outlook.com ([40.107.7.54]:28323 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729923AbfKVKs1 (ORCPT ); Fri, 22 Nov 2019 05:48:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TNjoN2JRhtOIhAQsCzxKg6H0PE+Ob9vAv98Rby1RK6DmUqaEsUSNAuW66VNFAnZlCo7EwzYdYBIdmtjlePIv/HwCLOwNrkSsy3IUal1rPZLuREG25lEV3XxexUfUOFu1zmPB9IkvdbJHUCw7BFRyr8rpzOQhwrbb+iDn56VbXapqRinGx4yx3WXUWYCrldjRkAZhCgmdM9Z9ZR7isbdw+tEBzBguxQE2EAJi4VIpamdRDJxsOXxDmpRcHeFUs2NpIVEj9W9+kcfsKEXujgkKEH0XHpbxCc6/1Qf5HmNFNBkMbRmGiP08Amd+sDICGj1nfln3QXn0QCZRTEwTCDXTww== 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=VR84e7KeizBu3qE+oCsthNWfYlpyMuz9oFUWH4kVzZA=; b=Y+ohO4H9N94nVTWI+t5On/iC0J9GkIlZCu89Zvo9E1rAl/jdVbd5O+Mq5XPJ+UoMAfwFxmAAkL+xpbMrmm93umTlGVEH1d3+idyLQkTsKyhLobdbsQpGUNRMLH0gNW+Ul3qFi57tbbYd7bovwnZTe8SFltPjdkWI22R0klSMt2U03slJebXxPDamXlx12IzuDxCYHZl1voXAaJXGtlegOKKDCWk3DJMNFKmfoStKb2io9tG/fDM7mdL52c43Iism6r01EaLSX1xoCJ3LOHM6sfr5SPMv8Pn4pyEZPy1jMXbTuVCjROe/Ncw8wUmcHFt0+ijKNbK/6XBAqcL7cmL1cQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VR84e7KeizBu3qE+oCsthNWfYlpyMuz9oFUWH4kVzZA=; b=HjBq0jeZ6owFjZRUBBwnWirk9qPgVd/CyO9RuIGEZfG1rTyYmuepKQfUDNgytalfM91HJK+Vlb1aFFB0t/RWWGF1tG2RWDP6OoRFvF6MK2X56jZ6GDL6hGBfNDTcK7DK8ItfCyYhlPUThKu3c8Dznibvj1YFv6qrwQeJexFEJgs= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB5074.eurprd04.prod.outlook.com (20.177.42.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 10:48:15 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde%7]) with mapi id 15.20.2474.019; Fri, 22 Nov 2019 10:48:15 +0000 From: Abel Vesa To: Aisheng Dong , Shawn Guo , Leonard Crestez , Stephen Boyd , Sascha Hauer , Jacky Bai CC: Peng Fan , dl-linux-imx , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Abel Vesa Subject: [PATCH v2 05/11] clk: imx: pllv2: Switch to clk_hw based API Thread-Topic: [PATCH v2 05/11] clk: imx: pllv2: Switch to clk_hw based API Thread-Index: AQHVoSJXaTujkjS7KUGyJEkLCMUF0g== Date: Fri, 22 Nov 2019 10:48:14 +0000 Message-ID: <1574419679-3813-6-git-send-email-abel.vesa@nxp.com> References: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:208:15::33) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.7.4 authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 15b2f7ec-1bdd-4624-65d2-08d76f397a09 x-ms-traffictypediagnostic: AM0PR04MB5074:|AM0PR04MB5074: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2657; x-forefront-prvs: 02296943FF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(346002)(376002)(396003)(136003)(189003)(199004)(478600001)(256004)(6506007)(54906003)(7736002)(305945005)(316002)(71200400001)(5660300002)(110136005)(102836004)(186003)(86362001)(66066001)(71190400001)(2906002)(4326008)(76176011)(99286004)(36756003)(26005)(52116002)(386003)(8936002)(3846002)(2616005)(446003)(44832011)(11346002)(66556008)(66476007)(66446008)(64756008)(6486002)(66946007)(6436002)(81166006)(8676002)(81156014)(6636002)(6512007)(25786009)(14454004)(50226002)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB5074;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pPREQRbxzcPs5v4QI9kbAgLLYbOWyU4qBCFFNtkpNyHs2AQP0iv7gAhwAyY5B+hzIpPWyWtnw7W8kaey6Zs+b1kLZ7X7iUgdltDek9oHDFsKPtvexnL+YGiOAteqmYUT1tE7VwUnhMpOLJvfu0RVGv86WJGPpUXpl7lkUxNKf52R+k7tt0jO0Y0uAntxnaVOAKfTpURG0GQtDsrSOdHg5Vm9kLy89QaCNbiQtIiaDAXfYnF8HYT66KPh+9FV8tPwtelr0PIqahcFmcCt7e2wMCT3gUSSUlUsiSgYwqesw1oEBZwbBJjCGF+1C/iixesJFkeRDLoxDDBCgoUsw+gRE1T6y6uLBS/Z2GHYHBtMk5uKiMqkrnzmiTOVtxdFs7qeWkqy9rjwBQ48Q1SFeL4uu9qBv2GlnnTxZIhURRzj0KPWUTaP9JY1sfbnxSvlezlY MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15b2f7ec-1bdd-4624-65d2-08d76f397a09 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2019 10:48:14.8799 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4IBBOmMecMZyckNZXJS0tHN2hL6uoBh9e3m1MfGMHFDVuaTQ1Hq+AjQ03jGVe+JV1yUNgkMo9Bhvl8aC7A2oCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5074 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Switch the imx_clk_pllv2 register function to clk_hw based API, rename accordingly and add a macro for clk based legacy. This allows us to move closer to a clear split between consumer and provider clk APIs. Signed-off-by: Abel Vesa Reviewed-by: Peng Fan --- drivers/clk/imx/clk-pllv2.c | 14 +++++++++----- drivers/clk/imx/clk.h | 5 ++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/clk/imx/clk-pllv2.c b/drivers/clk/imx/clk-pllv2.c index eeba3cb..ff17f06 100644 --- a/drivers/clk/imx/clk-pllv2.c +++ b/drivers/clk/imx/clk-pllv2.c @@ -239,12 +239,13 @@ static const struct clk_ops clk_pllv2_ops = { .set_rate = clk_pllv2_set_rate, }; -struct clk *imx_clk_pllv2(const char *name, const char *parent, +struct clk_hw *imx_clk_hw_pllv2(const char *name, const char *parent, void __iomem *base) { struct clk_pllv2 *pll; - struct clk *clk; + struct clk_hw *hw; struct clk_init_data init; + int ret; pll = kzalloc(sizeof(*pll), GFP_KERNEL); if (!pll) @@ -259,10 +260,13 @@ struct clk *imx_clk_pllv2(const char *name, const char *parent, init.num_parents = 1; pll->hw.init = &init; + hw = &pll->hw; - clk = clk_register(NULL, &pll->hw); - if (IS_ERR(clk)) + ret = clk_hw_register(NULL, hw); + if (ret) { kfree(pll); + return ERR_PTR(ret); + } - return clk; + return hw; } diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index bd6a592..331f5ab 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -112,13 +112,16 @@ extern struct imx_pll14xx_clk imx_1443x_pll; #define imx_clk_pllv1(type, name, parent, base) \ to_clk(imx_clk_hw_pllv1(type, name, parent, base)) +#define imx_clk_pllv2(name, parent, base) \ + to_clk(imx_clk_hw_pllv2(name, parent, base)) + struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, void __iomem *base, const struct imx_pll14xx_clk *pll_clk); struct clk_hw *imx_clk_hw_pllv1(enum imx_pllv1_type type, const char *name, const char *parent, void __iomem *base); -struct clk *imx_clk_pllv2(const char *name, const char *parent, +struct clk_hw *imx_clk_hw_pllv2(const char *name, const char *parent, void __iomem *base); struct clk *imx_clk_frac_pll(const char *name, const char *parent_name, From patchwork Fri Nov 22 10:48:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11257795 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 06304112B for ; Fri, 22 Nov 2019 11:17:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BEBA32070E for ; Fri, 22 Nov 2019 11:17:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="o8tAxHJc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728016AbfKVLRh (ORCPT ); Fri, 22 Nov 2019 06:17:37 -0500 Received: from mail-eopbgr20045.outbound.protection.outlook.com ([40.107.2.45]:34373 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729941AbfKVKsa (ORCPT ); Fri, 22 Nov 2019 05:48:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lZN/zFh93FKWLJf24kzCz7NED+mnYZ+zbtDD7cW0bwe9nxDF4c7fk3bkP6b7mxDTleD9Oit7Yxxf54nl1RxL/5UVqzkdne11mJLKO+6N88z89dwlhdVt/FO/hCIGfuodmx9hJoqWj1kCYKo4QlwsYp+CyhHYHb3kLCDcxDmFXS+a9XwK/fLVF+Mu3Tho/HITex4LnGa49UZXpWvuyFKVW70uqJ93CM8zvHwWbAoo0R/aAPFN7mxuwiYQsgGF88bDrQKX9CVldlM4VW9aT+vo1vW4B+gjqe+DoeE5dbms0QUD7uP7Nun3XPhPUE+XJxdNU55iYCbrYGCXfhPybbmRgQ== 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=47lDHV+5aiv2jdXqfwkm8wIcEOSkK2VfBXZ2VatH224=; b=b9PylZFJfnGca5gNBMwsQt3ayBiXVYrHLXmivsx1Xi5fPGAdNK8/FG7BJKLJSX9CGpqZk25NzTRiJ62b0xsimBe7tJ4Yr0D2Y2SvF2knkuHg9pdcs+W6eH23db1ztfWwki+KuGy5BzfMhp33NTGKHW+jmudS2xunIfN8689/Nkugudo2V+KzdiILLkiqzWE9CiRvz230YZxn+hcDJ4QM6du9bRm++6oGZB8mw8/Qeqnrybilg6fV7Znsi4xKjbh9nu+hdHCEwxJ2xqUwhbG/MXH7+vJg5L8iXpcsIJcptjEeKqZJL5I8E0CcXdhAaWkSdd5TW1k1Kw/dmXnL50n41g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=47lDHV+5aiv2jdXqfwkm8wIcEOSkK2VfBXZ2VatH224=; b=o8tAxHJcH+5gXTscxg6tLH4DDlVwYl8gZN/Aulfsi5SD4EFKkDts42QjCzkgqlPTsuWKAXh/T9GVHN1DkGa1klAUXU0vh8r8GNk1Wfb0OksC11Vyrngdooty9y7Sf1okrdXP8AUVsFyxj21ACad7Vgnp7aiIEjacPQLOowOTrL0= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB5074.eurprd04.prod.outlook.com (20.177.42.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 10:48:17 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde%7]) with mapi id 15.20.2474.019; Fri, 22 Nov 2019 10:48:17 +0000 From: Abel Vesa To: Aisheng Dong , Shawn Guo , Leonard Crestez , Stephen Boyd , Sascha Hauer , Jacky Bai CC: Peng Fan , dl-linux-imx , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Abel Vesa Subject: [PATCH v2 06/11] clk: imx: imx7ulp composite: Rename to show is clk_hw based Thread-Topic: [PATCH v2 06/11] clk: imx: imx7ulp composite: Rename to show is clk_hw based Thread-Index: AQHVoSJY0pntNPhTwUGCj9LqvBpqnQ== Date: Fri, 22 Nov 2019 10:48:15 +0000 Message-ID: <1574419679-3813-7-git-send-email-abel.vesa@nxp.com> References: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:208:15::33) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.7.4 authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d83ad8d6-fdd5-481e-e700-08d76f397a8f x-ms-traffictypediagnostic: AM0PR04MB5074:|AM0PR04MB5074: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:619; x-forefront-prvs: 02296943FF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(346002)(376002)(396003)(136003)(189003)(199004)(478600001)(14444005)(256004)(6506007)(54906003)(30864003)(7736002)(305945005)(316002)(71200400001)(5660300002)(110136005)(102836004)(186003)(86362001)(66066001)(71190400001)(2906002)(4326008)(76176011)(99286004)(36756003)(26005)(52116002)(386003)(8936002)(3846002)(2616005)(446003)(44832011)(11346002)(66556008)(66476007)(66446008)(64756008)(6486002)(66946007)(6436002)(81166006)(8676002)(81156014)(6636002)(6512007)(25786009)(14454004)(50226002)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB5074;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yf/RpvKXqwgY6XqZDrANJvRzS8aw0qsADOYRtxuxzLLSbqg2cIxiX6dT4pV++ztBPP/5Eu+GxVXURFSKMRDexYx+PS761qDNAu9T5aO19cxwi3xOhK6hJt8vMYGuAo3fZDukXJujyHAc8B8YpBErrPiTLP7G2uZxmJ2eJ/z97WVX0hh+d1iqIZuSqthxSqKTifA36WG9buepgPVi7Ow/1xtelmznucqzmPJFNjBKA4sxVjVyIQOk2+kFw6YNHfpgSxXQjPCtbd1/7dTpWkBu+tvrTjibFpdGOlp9m9AHeD0/oItZWnVmgJAtr7E/Sau1/QNJ030siUI+alvN5k7Deg78DAjZR7ZiTDWh7IDzrqqYzuGU8geZpkPPQDfh374JQwMWkZpJ6Y5lmkqQ4+xchXlVnWYShk7Yqt8b8MgdWkDKqBI97nEPGqWTWUkCNA2m MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d83ad8d6-fdd5-481e-e700-08d76f397a8f X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2019 10:48:15.7973 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1J9I1x1k8KqwuO9xxhB7XKH+/ZIYjdWZYD7hW4wRj3xeG5ujHRVScezYbKNGRbIpPvbbn23Aq5Iehx8LDFn+Pg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5074 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Renaming the imx7ulp_clk_composite register function to imx7ulp_clk_hw_composite to show it is clk_hw based. Signed-off-by: Abel Vesa Reviewed-by: Peng Fan --- drivers/clk/imx/clk-composite-7ulp.c | 2 +- drivers/clk/imx/clk-imx7ulp.c | 52 ++++++++++++++++++------------------ drivers/clk/imx/clk.h | 2 +- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/clk/imx/clk-composite-7ulp.c b/drivers/clk/imx/clk-composite-7ulp.c index 060f860..b9efcc8 100644 --- a/drivers/clk/imx/clk-composite-7ulp.c +++ b/drivers/clk/imx/clk-composite-7ulp.c @@ -21,7 +21,7 @@ #define PCG_PCD_WIDTH 3 #define PCG_PCD_MASK 0x7 -struct clk_hw *imx7ulp_clk_composite(const char *name, +struct clk_hw *imx7ulp_clk_hw_composite(const char *name, const char * const *parent_names, int num_parents, bool mux_present, bool rate_present, bool gate_present, diff --git a/drivers/clk/imx/clk-imx7ulp.c b/drivers/clk/imx/clk-imx7ulp.c index 3fdf3d4..64b79a8 100644 --- a/drivers/clk/imx/clk-imx7ulp.c +++ b/drivers/clk/imx/clk-imx7ulp.c @@ -165,23 +165,23 @@ static void __init imx7ulp_clk_pcc2_init(struct device_node *np) clks[IMX7ULP_CLK_RGPIO2P1] = imx_clk_hw_gate("rgpio2p1", "nic1_bus_clk", base + 0x3c, 30); clks[IMX7ULP_CLK_DMA_MUX1] = imx_clk_hw_gate("dma_mux1", "nic1_bus_clk", base + 0x84, 30); clks[IMX7ULP_CLK_CAAM] = imx_clk_hw_gate("caam", "nic1_clk", base + 0x90, 30); - clks[IMX7ULP_CLK_LPTPM4] = imx7ulp_clk_composite("lptpm4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x94); - clks[IMX7ULP_CLK_LPTPM5] = imx7ulp_clk_composite("lptpm5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x98); - clks[IMX7ULP_CLK_LPIT1] = imx7ulp_clk_composite("lpit1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x9c); - clks[IMX7ULP_CLK_LPSPI2] = imx7ulp_clk_composite("lpspi2", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xa4); - clks[IMX7ULP_CLK_LPSPI3] = imx7ulp_clk_composite("lpspi3", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xa8); - clks[IMX7ULP_CLK_LPI2C4] = imx7ulp_clk_composite("lpi2c4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xac); - clks[IMX7ULP_CLK_LPI2C5] = imx7ulp_clk_composite("lpi2c5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb0); - clks[IMX7ULP_CLK_LPUART4] = imx7ulp_clk_composite("lpuart4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb4); - clks[IMX7ULP_CLK_LPUART5] = imx7ulp_clk_composite("lpuart5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb8); - clks[IMX7ULP_CLK_FLEXIO1] = imx7ulp_clk_composite("flexio1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xc4); - clks[IMX7ULP_CLK_USB0] = imx7ulp_clk_composite("usb0", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xcc); - clks[IMX7ULP_CLK_USB1] = imx7ulp_clk_composite("usb1", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xd0); + clks[IMX7ULP_CLK_LPTPM4] = imx7ulp_clk_hw_composite("lptpm4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x94); + clks[IMX7ULP_CLK_LPTPM5] = imx7ulp_clk_hw_composite("lptpm5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x98); + clks[IMX7ULP_CLK_LPIT1] = imx7ulp_clk_hw_composite("lpit1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x9c); + clks[IMX7ULP_CLK_LPSPI2] = imx7ulp_clk_hw_composite("lpspi2", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xa4); + clks[IMX7ULP_CLK_LPSPI3] = imx7ulp_clk_hw_composite("lpspi3", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xa8); + clks[IMX7ULP_CLK_LPI2C4] = imx7ulp_clk_hw_composite("lpi2c4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xac); + clks[IMX7ULP_CLK_LPI2C5] = imx7ulp_clk_hw_composite("lpi2c5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb0); + clks[IMX7ULP_CLK_LPUART4] = imx7ulp_clk_hw_composite("lpuart4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb4); + clks[IMX7ULP_CLK_LPUART5] = imx7ulp_clk_hw_composite("lpuart5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb8); + clks[IMX7ULP_CLK_FLEXIO1] = imx7ulp_clk_hw_composite("flexio1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xc4); + clks[IMX7ULP_CLK_USB0] = imx7ulp_clk_hw_composite("usb0", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xcc); + clks[IMX7ULP_CLK_USB1] = imx7ulp_clk_hw_composite("usb1", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xd0); clks[IMX7ULP_CLK_USB_PHY] = imx_clk_hw_gate("usb_phy", "nic1_bus_clk", base + 0xd4, 30); - clks[IMX7ULP_CLK_USDHC0] = imx7ulp_clk_composite("usdhc0", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xdc); - clks[IMX7ULP_CLK_USDHC1] = imx7ulp_clk_composite("usdhc1", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xe0); - clks[IMX7ULP_CLK_WDG1] = imx7ulp_clk_composite("wdg1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0xf4); - clks[IMX7ULP_CLK_WDG2] = imx7ulp_clk_composite("sdg2", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0x10c); + clks[IMX7ULP_CLK_USDHC0] = imx7ulp_clk_hw_composite("usdhc0", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xdc); + clks[IMX7ULP_CLK_USDHC1] = imx7ulp_clk_hw_composite("usdhc1", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xe0); + clks[IMX7ULP_CLK_WDG1] = imx7ulp_clk_hw_composite("wdg1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0xf4); + clks[IMX7ULP_CLK_WDG2] = imx7ulp_clk_hw_composite("sdg2", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0x10c); imx_check_clk_hws(clks, clk_data->num); @@ -216,17 +216,17 @@ static void __init imx7ulp_clk_pcc3_init(struct device_node *np) base = of_iomap(np, 0); WARN_ON(!base); - clks[IMX7ULP_CLK_LPTPM6] = imx7ulp_clk_composite("lptpm6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x84); - clks[IMX7ULP_CLK_LPTPM7] = imx7ulp_clk_composite("lptpm7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x88); + clks[IMX7ULP_CLK_LPTPM6] = imx7ulp_clk_hw_composite("lptpm6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x84); + clks[IMX7ULP_CLK_LPTPM7] = imx7ulp_clk_hw_composite("lptpm7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x88); clks[IMX7ULP_CLK_MMDC] = clk_hw_register_gate(NULL, "mmdc", "nic1_clk", CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, base + 0xac, 30, 0, &imx_ccm_lock); - clks[IMX7ULP_CLK_LPI2C6] = imx7ulp_clk_composite("lpi2c6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x90); - clks[IMX7ULP_CLK_LPI2C7] = imx7ulp_clk_composite("lpi2c7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x94); - clks[IMX7ULP_CLK_LPUART6] = imx7ulp_clk_composite("lpuart6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x98); - clks[IMX7ULP_CLK_LPUART7] = imx7ulp_clk_composite("lpuart7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x9c); - clks[IMX7ULP_CLK_DSI] = imx7ulp_clk_composite("dsi", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0xa4); - clks[IMX7ULP_CLK_LCDIF] = imx7ulp_clk_composite("lcdif", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xa8); + clks[IMX7ULP_CLK_LPI2C6] = imx7ulp_clk_hw_composite("lpi2c6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x90); + clks[IMX7ULP_CLK_LPI2C7] = imx7ulp_clk_hw_composite("lpi2c7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x94); + clks[IMX7ULP_CLK_LPUART6] = imx7ulp_clk_hw_composite("lpuart6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x98); + clks[IMX7ULP_CLK_LPUART7] = imx7ulp_clk_hw_composite("lpuart7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x9c); + clks[IMX7ULP_CLK_DSI] = imx7ulp_clk_hw_composite("dsi", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0xa4); + clks[IMX7ULP_CLK_LCDIF] = imx7ulp_clk_hw_composite("lcdif", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xa8); clks[IMX7ULP_CLK_VIU] = imx_clk_hw_gate("viu", "nic1_clk", base + 0xa0, 30); clks[IMX7ULP_CLK_PCTLC] = imx_clk_hw_gate("pctlc", "nic1_bus_clk", base + 0xb8, 30); @@ -234,8 +234,8 @@ static void __init imx7ulp_clk_pcc3_init(struct device_node *np) clks[IMX7ULP_CLK_PCTLE] = imx_clk_hw_gate("pctle", "nic1_bus_clk", base + 0xc0, 30); clks[IMX7ULP_CLK_PCTLF] = imx_clk_hw_gate("pctlf", "nic1_bus_clk", base + 0xc4, 30); - clks[IMX7ULP_CLK_GPU3D] = imx7ulp_clk_composite("gpu3d", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, false, true, base + 0x140); - clks[IMX7ULP_CLK_GPU2D] = imx7ulp_clk_composite("gpu2d", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, false, true, base + 0x144); + clks[IMX7ULP_CLK_GPU3D] = imx7ulp_clk_hw_composite("gpu3d", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, false, true, base + 0x140); + clks[IMX7ULP_CLK_GPU2D] = imx7ulp_clk_hw_composite("gpu2d", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, false, true, base + 0x144); imx_check_clk_hws(clks, clk_data->num); diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 331f5ab..d6c65f0 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -202,7 +202,7 @@ struct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift u8 width, void __iomem *busy_reg, u8 busy_shift, const char * const *parent_names, int num_parents); -struct clk_hw *imx7ulp_clk_composite(const char *name, +struct clk_hw *imx7ulp_clk_hw_composite(const char *name, const char * const *parent_names, int num_parents, bool mux_present, bool rate_present, bool gate_present, From patchwork Fri Nov 22 10:48:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11257809 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 85E50109A for ; Fri, 22 Nov 2019 11:18:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DB0020748 for ; Fri, 22 Nov 2019 11:18:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Iym2zVnG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729293AbfKVLSY (ORCPT ); Fri, 22 Nov 2019 06:18:24 -0500 Received: from mail-eopbgr60040.outbound.protection.outlook.com ([40.107.6.40]:54809 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729904AbfKVKsV (ORCPT ); Fri, 22 Nov 2019 05:48:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ogMJF0ItoKS7deLeO+MWiNxwnziPsBCm5yZZRWmAdQXZhjs1F0Wj9TzKwsr1uNTd5H6PXDTA2fUVHwhxFRS8qVukBKCAgf9nKT4/nmg9FLEeZA1yrtBcgpZr4gaPBkNkxbDotloiRSEYusb7kQ/mLm1SbzEmL/pH9SyNaXbxbf8APMXsXW9mrwCjpjIB//yforulMllv3KxjvdsLLoNj8UCYQb2iqw9YRWYMW9L2s2sJuUED5R1fnOcmMHTy9s/Vm4QWmtHeVXfaPl3ypSS2+pDm5ddSkmF4Zvz2GEHECnI8LfvfVDJ5JfRH9zHNeXSqC7+Bj1MJvRgrMLyI6Uhvnw== 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=3qqqySnUx5hbngPXJSn7qDcJcQbjLOyL9Ze+Zk60ShI=; b=LYEu6u7ncJal+wUzaCQEUr+Rg0II3FhrnLLSA9iYdCckDTFe2NV7TVUPt7Ba9KGW0uHLalNxMAu2/VMVP1BEmWyHkdb1aS9YlMTP2MxtU9d3bDyGVUNi81cvuLDFdGBKbasrEeG9tIgH5xoYv1iuUFOnKAsBcguENzN4cVCULmeuBSc0RHk4s2UGpua8OeIj9sRdp2Gk8zV6YOz/HSuUzqRC8h6CVneKhKtB/+UaAOxptws67q2W9ddo7v5QtXGFXrOlsJ0Sj7Xlsr/+nd/bDb3P80cyOkZjUGcATnzq8fNOzDplo/D+bycGEB5jSo07Y/Dt9q4616zEOLAigBZFsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3qqqySnUx5hbngPXJSn7qDcJcQbjLOyL9Ze+Zk60ShI=; b=Iym2zVnGD71PvhClTe/ASh+YSIJ7CIR16quepGhQAyyCZsQR7j5+f2iCs4UBM3dXd9K2NzmmjFKpLW6o2RY9U74b3n3sYr2kunrU88sS2Q3+ZiT1LBRA68D5/lH+QzGewnhpuVPsKsn8+wvupt6HJoQPUkthR3ItbmFLxoH0q3A= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB6961.eurprd04.prod.outlook.com (52.132.212.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 10:48:17 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde%7]) with mapi id 15.20.2474.019; Fri, 22 Nov 2019 10:48:17 +0000 From: Abel Vesa To: Aisheng Dong , Shawn Guo , Leonard Crestez , Stephen Boyd , Sascha Hauer , Jacky Bai CC: Peng Fan , dl-linux-imx , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Abel Vesa Subject: [PATCH v2 07/11] clk: imx: Rename sccg and frac pll register to suggest clk_hw Thread-Topic: [PATCH v2 07/11] clk: imx: Rename sccg and frac pll register to suggest clk_hw Thread-Index: AQHVoSJYdI0dfcrcUkSeoWKrP5yyHg== Date: Fri, 22 Nov 2019 10:48:16 +0000 Message-ID: <1574419679-3813-8-git-send-email-abel.vesa@nxp.com> References: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:208:15::33) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.7.4 authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 92471ecd-12be-44f1-f26a-08d76f397b1e x-ms-traffictypediagnostic: AM0PR04MB6961:|AM0PR04MB6961: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:989; x-forefront-prvs: 02296943FF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(136003)(376002)(39860400002)(396003)(346002)(189003)(199004)(186003)(44832011)(446003)(11346002)(2616005)(52116002)(76176011)(66446008)(64756008)(66556008)(66476007)(7736002)(478600001)(6636002)(36756003)(5660300002)(6506007)(26005)(2906002)(86362001)(14454004)(102836004)(386003)(305945005)(25786009)(66946007)(256004)(110136005)(8936002)(50226002)(6116002)(316002)(99286004)(54906003)(81166006)(81156014)(8676002)(6436002)(6512007)(4326008)(71190400001)(3846002)(71200400001)(66066001)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB6961;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: qTh15l9nxloArqUScywHo/zhF1J1vavZpfEPwEkhDp/wTXHpeiNiPfksRUJEs7YW/hVvLpUWstoigBKQ/h2uJC3V3oVe8BuHRpdOUBXJVzJD1cN5Gj/6ie2ED5NI67ENxObRh5/GrCbnuq+YOCIQyVPRgADSDnUDR99gMKnk+kKMG/lOdQXh7R66Qim1nQI95PllMU9ZhJ2vELRiB2j6NhmIct26oYWZFBucBb3zK67OPYQErl6aueUUF63S3SouD2d8mu9SmNx++6wL8KN433jvbmkaXwEQR/pT+uJOsPCrLdqejZGV9t2nWrj2cH9lJHpNg7rxn20feKwHiZuy0Ea8CfR2L4U/a1KuLyltoRhU3J7WgxYFprnkNob2JRfkPTbrMkXA3jhngPYPbPnG8mcGXzO+oY0ulAHHjmSoSRBz+ICk+wgOaazNu0Wm5IvB MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92471ecd-12be-44f1-f26a-08d76f397b1e X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2019 10:48:16.7138 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ydbsT2hH2pz6WD+gB9JjK/b5vUERUrHHamZXyZTaBSKjM0grGxJg2VZ/n6+KgBw/Qo435fyRZUX9a3LTtF3wIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6961 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Renaming the imx_clk_frac_pll and imx_clk_sccg_pll register functions to imx_clk_hw_frac_pll, respectively imx_clk_hw_sccg_pll to be more obvious that they are clk_hw based. Signed-off-by: Abel Vesa Reviewed-by: Peng Fan --- drivers/clk/imx/clk-frac-pll.c | 7 ++++--- drivers/clk/imx/clk-sscg-pll.c | 4 ++-- drivers/clk/imx/clk.h | 12 ++++++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/clk/imx/clk-frac-pll.c b/drivers/clk/imx/clk-frac-pll.c index fece503..101e0a3 100644 --- a/drivers/clk/imx/clk-frac-pll.c +++ b/drivers/clk/imx/clk-frac-pll.c @@ -201,8 +201,9 @@ static const struct clk_ops clk_frac_pll_ops = { .set_rate = clk_pll_set_rate, }; -struct clk *imx_clk_frac_pll(const char *name, const char *parent_name, - void __iomem *base) +struct clk_hw *imx_clk_hw_frac_pll(const char *name, + const char *parent_name, + void __iomem *base) { struct clk_init_data init; struct clk_frac_pll *pll; @@ -230,5 +231,5 @@ struct clk *imx_clk_frac_pll(const char *name, const char *parent_name, return ERR_PTR(ret); } - return hw->clk; + return hw; } diff --git a/drivers/clk/imx/clk-sscg-pll.c b/drivers/clk/imx/clk-sscg-pll.c index 0669e17..acd1b90 100644 --- a/drivers/clk/imx/clk-sscg-pll.c +++ b/drivers/clk/imx/clk-sscg-pll.c @@ -506,7 +506,7 @@ static const struct clk_ops clk_sscg_pll_ops = { .determine_rate = clk_sscg_pll_determine_rate, }; -struct clk *imx_clk_sscg_pll(const char *name, +struct clk_hw *imx_clk_hw_sscg_pll(const char *name, const char * const *parent_names, u8 num_parents, u8 parent, u8 bypass1, u8 bypass2, @@ -545,5 +545,5 @@ struct clk *imx_clk_sscg_pll(const char *name, return ERR_PTR(ret); } - return hw->clk; + return hw; } diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index d6c65f0..a7d86df 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -115,6 +115,14 @@ extern struct imx_pll14xx_clk imx_1443x_pll; #define imx_clk_pllv2(name, parent, base) \ to_clk(imx_clk_hw_pllv2(name, parent, base)) +#define imx_clk_frac_pll(name, parent_name, base) \ + to_clk(imx_clk_hw_frac_pll(name, parent_name, base)) + +#define imx_clk_sscg_pll(name, parent_names, num_parents, parent,\ + bypass1, bypass2, base, flags) \ + to_clk(imx_clk_hw_sscg_pll(name, parent_names, num_parents, parent,\ + bypass1, bypass2, base, flags)) + struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, void __iomem *base, const struct imx_pll14xx_clk *pll_clk); @@ -124,10 +132,10 @@ struct clk_hw *imx_clk_hw_pllv1(enum imx_pllv1_type type, const char *name, struct clk_hw *imx_clk_hw_pllv2(const char *name, const char *parent, void __iomem *base); -struct clk *imx_clk_frac_pll(const char *name, const char *parent_name, +struct clk_hw *imx_clk_hw_frac_pll(const char *name, const char *parent_name, void __iomem *base); -struct clk *imx_clk_sscg_pll(const char *name, +struct clk_hw *imx_clk_hw_sscg_pll(const char *name, const char * const *parent_names, u8 num_parents, u8 parent, u8 bypass1, u8 bypass2, From patchwork Fri Nov 22 10:48:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11257807 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E45EB112B for ; Fri, 22 Nov 2019 11:18:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB89A2075B for ; Fri, 22 Nov 2019 11:18:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="PhU/QG3A" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727806AbfKVLSE (ORCPT ); Fri, 22 Nov 2019 06:18:04 -0500 Received: from mail-eopbgr60040.outbound.protection.outlook.com ([40.107.6.40]:54809 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729426AbfKVKsZ (ORCPT ); Fri, 22 Nov 2019 05:48:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RvX3AwAHgoQwJdftdhKoxG9p64yGUyp+WmSvsz+FM9t3a7/Pg9sfSCeKGCBrmwldIK0w7vRFUi/5SIWZ70oXTqdFKqIJqaHrkQxsKsKZPWoo3XVMQWIY7IIvQ9IDX/pK6oizwpjxrsGh65bfku2+XTfRmj2WpLPVJ5efCSZJcfqpEh3liiK8TFTuCdIXabvGu/GEDWpPDaydSMegnnuvGITkVPWr+D1+BxNex8AUjKduxmsjqCoeIYtYzf8BarRRyPX2URMZycKyw/2QQjdgyYImDeC/4qpPmBl9CEX0Zkl+7v9w9C7j8sgj/snZcTMYbjUsqxZNuv4zhWziet6NtQ== 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=aFcaMaCiNx93r3/J5tg+mOqtpfn/9ha3QAxyPVxVuOQ=; b=TYWnAgvWE1FabD/1YNlk5+tQ5JZlNFuL8q9KVYwgqn+J5S13avB2hv1mHXet/dP2obxPF1gfLOAImBD7biF1HbLW566X95QL2N1BduHUyIqvWRgPFS5GWwCdz664zSojjDvepdqkWvKO7SCX8adThP/Rh1ykmt2SVAAli7FN3p5AmGhIkKwc7luSv0g7E+PUJNb5Uhv+G9JATpuFG/1IAcTYqA/1EotyVwXD0racKeGPW3cOhWhcZTsxP70sk5E6qcxgX5vhTIj4CuJt/V0IUkzYIrrMVk4zoeziO8WlujvrZgU1olrWRoeQssOM73XDVLyMUeOeflED0KMGh1nc6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aFcaMaCiNx93r3/J5tg+mOqtpfn/9ha3QAxyPVxVuOQ=; b=PhU/QG3A6AYWPZ6+4DAUSy/2l6TImk3320jZxcyA2a5E2psGfenAHaPY5p2B2QY7SrJxJp6Wcgm5W5wdJr8uKTJ3FR9vG6Cs0HX1z+NsbHytrtWIUk+g22AmzhsYqzb63K2w5yzLCqXTMEa3xPybYA8yVZQz/x/y+dB+lNSlnaQ= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB6961.eurprd04.prod.outlook.com (52.132.212.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 10:48:18 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde%7]) with mapi id 15.20.2474.019; Fri, 22 Nov 2019 10:48:18 +0000 From: Abel Vesa To: Aisheng Dong , Shawn Guo , Leonard Crestez , Stephen Boyd , Sascha Hauer , Jacky Bai CC: Peng Fan , dl-linux-imx , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Abel Vesa Subject: [PATCH v2 08/11] clk: imx: Rename the imx_clk_pllv4 to imply it's clk_hw based Thread-Topic: [PATCH v2 08/11] clk: imx: Rename the imx_clk_pllv4 to imply it's clk_hw based Thread-Index: AQHVoSJZWozaeArIAU+WAPCOiKGqBw== Date: Fri, 22 Nov 2019 10:48:17 +0000 Message-ID: <1574419679-3813-9-git-send-email-abel.vesa@nxp.com> References: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:208:15::33) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.7.4 authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 9dd29a45-3004-4027-02f1-08d76f397ba3 x-ms-traffictypediagnostic: AM0PR04MB6961:|AM0PR04MB6961: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1247; x-forefront-prvs: 02296943FF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(136003)(376002)(39860400002)(396003)(346002)(189003)(199004)(186003)(44832011)(446003)(11346002)(2616005)(52116002)(76176011)(66446008)(64756008)(66556008)(66476007)(7736002)(478600001)(6636002)(36756003)(5660300002)(6506007)(26005)(2906002)(86362001)(14454004)(102836004)(386003)(305945005)(25786009)(66946007)(256004)(110136005)(8936002)(50226002)(6116002)(316002)(99286004)(54906003)(81166006)(81156014)(8676002)(6436002)(6512007)(4326008)(71190400001)(3846002)(71200400001)(66066001)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB6961;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: gyw0GSAw3xS+eR53JAKNvZtkJLv80RiStM+BkqQ1FhdmpFFdK1/7wnuGP287hPTKSWJ+H9rCEnOpASqCA8VtflljntNmTdc70M4HI14SEqiHHf9b8upu3r+l9GLv4tka2d0PRmkSD0siJyWZr6uM0Xgho6a2Yf9o+8oKHOSy4z1v1/XlmvpTAObMvxavgpeL34wwhocgmsTkxPgOG0gNaq03/lbkykOHRvgwwukGJgcn9EjQqHHhQRwW9WlgYwDg/ZpkZRLgk0zWlh/wNCVm2MT01OV3ZLTg+Ai85Eml/nNzfAE9/WEquOL1tMYjKlCCMnXMJfkHPeqjn25a/ZeypQqaIRfHx/NKGvplZlPkmBTZaojb7DCIVzs4jR822S0Sty7vi4y+9Qery8R6oBIW8cI4XvtumOYTV7YJiERG3BNpvk4fWVhzEAdbOA8HexPS MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9dd29a45-3004-4027-02f1-08d76f397ba3 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2019 10:48:17.6992 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: XWn62rVvP7df+FzgkWZs5MWVp8s5TxITNW/NR1bYlLFCX4YtZfPSd9zs+b/wNPA0IdwtueJKKIppEdrNnflpgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6961 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Renaming the imx_clk_pllv4 register function to imx_clk_hw_pllv4 to be more obvious it is clk_hw based. Signed-off-by: Abel Vesa Reviewed-by: Peng Fan --- drivers/clk/imx/clk-imx7ulp.c | 4 ++-- drivers/clk/imx/clk-pllv4.c | 2 +- drivers/clk/imx/clk.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/imx/clk-imx7ulp.c b/drivers/clk/imx/clk-imx7ulp.c index 64b79a8..afd2c2c 100644 --- a/drivers/clk/imx/clk-imx7ulp.c +++ b/drivers/clk/imx/clk-imx7ulp.c @@ -90,8 +90,8 @@ static void __init imx7ulp_clk_scg1_init(struct device_node *np) clks[IMX7ULP_CLK_SPLL_PRE_DIV] = imx_clk_hw_divider_flags("spll_pre_div", "spll_pre_sel", base + 0x608, 8, 3, CLK_SET_RATE_GATE); /* name parent_name base */ - clks[IMX7ULP_CLK_APLL] = imx_clk_pllv4("apll", "apll_pre_div", base + 0x500); - clks[IMX7ULP_CLK_SPLL] = imx_clk_pllv4("spll", "spll_pre_div", base + 0x600); + clks[IMX7ULP_CLK_APLL] = imx_clk_hw_pllv4("apll", "apll_pre_div", base + 0x500); + clks[IMX7ULP_CLK_SPLL] = imx_clk_hw_pllv4("spll", "spll_pre_div", base + 0x600); /* APLL PFDs */ clks[IMX7ULP_CLK_APLL_PFD0] = imx_clk_pfdv2("apll_pfd0", "apll", base + 0x50c, 0); diff --git a/drivers/clk/imx/clk-pllv4.c b/drivers/clk/imx/clk-pllv4.c index 8155b12..f51a800 100644 --- a/drivers/clk/imx/clk-pllv4.c +++ b/drivers/clk/imx/clk-pllv4.c @@ -206,7 +206,7 @@ static const struct clk_ops clk_pllv4_ops = { .is_enabled = clk_pllv4_is_enabled, }; -struct clk_hw *imx_clk_pllv4(const char *name, const char *parent_name, +struct clk_hw *imx_clk_hw_pllv4(const char *name, const char *parent_name, void __iomem *base) { struct clk_pllv4 *pll; diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index a7d86df..5ca4615 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -175,7 +175,7 @@ struct clk_hw *imx_clk_hw_pllv3(enum imx_pllv3_type type, const char *name, .kdiv = (_k), \ } -struct clk_hw *imx_clk_pllv4(const char *name, const char *parent_name, +struct clk_hw *imx_clk_hw_pllv4(const char *name, const char *parent_name, void __iomem *base); struct clk_hw *clk_hw_register_gate2(struct device *dev, const char *name, From patchwork Fri Nov 22 10:48:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11257681 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12CDC109A for ; Fri, 22 Nov 2019 10:48:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD02E20731 for ; Fri, 22 Nov 2019 10:48:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="aXdnFEhE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729942AbfKVKs2 (ORCPT ); Fri, 22 Nov 2019 05:48:28 -0500 Received: from mail-eopbgr60040.outbound.protection.outlook.com ([40.107.6.40]:54809 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728945AbfKVKs1 (ORCPT ); Fri, 22 Nov 2019 05:48:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fQzwECHSADIN4sL7QNLZRAl0o936yddiuSLoG5nYCVoMdtfLiuyU+WxSm3zvnF3GlyCAs0kUjKF7KHvIzbClBRut2nrSvwtHzRQAQ6vWSbQQLijhz3pvXua/FfAU8wubbKe0zwVRHiN+Sw5goBXFto9zKhYYISEtdGXYH8do3b3oljC4oTl1uRKVQlHPDXupuxAKKNaUEYHOBvlpiglkVYgJMgYzVpPeBKyhX4iFPWbg6l0RlLwKS5IbTr0Kx2bcnOzsm3WKf8WXZ2f8FmD2sunbgzvk0KjgZcURV+aSeKpz6vBsF9u4aIr20z8OPc8eR162rXDM7A/2mSY//dbvzQ== 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=CPuYv25hNO5SD3jJI5LLppub0qnpHRLE7dhh40VZzOw=; b=bDVm/R03yIxIpg9x7Av9Rl8VZQKszNKBFDdbIkG8vwy4xuX2NXTahR1d+KBTagSMV4DfnGPBRyQno4m9nliDFVPkQdSU3fZC4H1axb1JldJsh13LWoKBlVU+TqFxy5vSl2IWu8oDv5K9m5iWBHiWKgFaud8MqrejUnsAZkbQTUtGD6+sa3MB4EONDiUInqKKiNGBpBUwBuroyWwUqyEl3M3CyVM1IPaRSD4ivxX3MeHsF07oVuy5ozDeaXhGPus5ycVaFWaaezkfRbaSJZ3e/e9KGNwstjuullc6Ic7YWRW9Wd7nIHuwIxb+SmYCaAOg3lIaeEUygwfSkyeS8TRDDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CPuYv25hNO5SD3jJI5LLppub0qnpHRLE7dhh40VZzOw=; b=aXdnFEhEpbZqTiaDUejUuM+45AiWAl3uJdWV3ef0Hgxb4CVry7Sz256OLar6H/w0PdSHNlVGITkPil0632OjiAvx2NeNF1e+3fY/SGE5IFlJhcbXMxPG9vffQFdPo8tyWpLDkhzUolUIRChyOZjUXAxeIy5Lz9A2/bZ5f3juiw0= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB6961.eurprd04.prod.outlook.com (52.132.212.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 10:48:19 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde%7]) with mapi id 15.20.2474.019; Fri, 22 Nov 2019 10:48:19 +0000 From: Abel Vesa To: Aisheng Dong , Shawn Guo , Leonard Crestez , Stephen Boyd , Sascha Hauer , Jacky Bai CC: Peng Fan , dl-linux-imx , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Abel Vesa Subject: [PATCH v2 09/11] clk: imx: Rename the imx_clk_pfdv2 to imply it's clk_hw based Thread-Topic: [PATCH v2 09/11] clk: imx: Rename the imx_clk_pfdv2 to imply it's clk_hw based Thread-Index: AQHVoSJZkx/MqnVoLEGsmkLg5Tj5Mw== Date: Fri, 22 Nov 2019 10:48:18 +0000 Message-ID: <1574419679-3813-10-git-send-email-abel.vesa@nxp.com> References: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:208:15::33) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.7.4 authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: fb02c53a-d149-4c19-393b-08d76f397c39 x-ms-traffictypediagnostic: AM0PR04MB6961:|AM0PR04MB6961: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1247; x-forefront-prvs: 02296943FF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(136003)(376002)(39860400002)(396003)(346002)(189003)(199004)(186003)(44832011)(446003)(11346002)(2616005)(52116002)(76176011)(66446008)(64756008)(66556008)(66476007)(7736002)(478600001)(6636002)(36756003)(5660300002)(6506007)(26005)(2906002)(86362001)(14454004)(102836004)(386003)(305945005)(25786009)(66946007)(256004)(110136005)(8936002)(50226002)(6116002)(316002)(99286004)(54906003)(81166006)(81156014)(8676002)(6436002)(6512007)(4326008)(71190400001)(3846002)(71200400001)(66066001)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB6961;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: PI0JsTmpgUOzaFShL67BdJWOJw3u3TwPnurufj2FestnUG1VPj659XhGCZhsjtS6+Q6+Y6iM14fiPCutSobvBmL5VEvL7TTauJAY1g3i9aZeve3fE63RMdkdUJ+UCHs3mOnX96l66Bm5xXx8JDO6l6DEHTzdVgy7kqCVSo57TYo7LaJUIDbbfTMF59feWxi17Y3Dq7jGqLBYnFeVtTe3Cf8qzq0+0fNhg4a+iLhZ10chh2C7JFDyajTSKs9Y0OKUIzhPhlkdhAZc+0k7B11eq5QK7RFXq7p5yTq+iHADnfMJ2u3Eh70rkbmY45972H9TDQO33Uu9q/iyEgi/votYyVtb1v44OBOmSeeHz49qPz7NlBltSHXMIHVu2wUms8QhLaQdLMMHB4cLObxO3F/hGzDJZPxC9hPS2hAIvDNxW47lQO0+1sB6lCFmBsnsiI2d MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb02c53a-d149-4c19-393b-08d76f397c39 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2019 10:48:18.5767 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: BmeWlIN0USc8cOdgzCL8vzEGP0AnKwUa/UOBSR9Y6O2M1tpiOg4i79mvASUhNyVxtoCI7bTYoff8+yV7UOPT7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6961 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Renaming the imx_clk_pfdv2 register function to imx_clk_hw_pfdv2 to be more obvious it is clk_hw based. Signed-off-by: Abel Vesa Reviewed-by: Peng Fan --- drivers/clk/imx/clk-imx7ulp.c | 16 ++++++++-------- drivers/clk/imx/clk-pfdv2.c | 2 +- drivers/clk/imx/clk.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/clk/imx/clk-imx7ulp.c b/drivers/clk/imx/clk-imx7ulp.c index afd2c2c..314f9c2 100644 --- a/drivers/clk/imx/clk-imx7ulp.c +++ b/drivers/clk/imx/clk-imx7ulp.c @@ -94,16 +94,16 @@ static void __init imx7ulp_clk_scg1_init(struct device_node *np) clks[IMX7ULP_CLK_SPLL] = imx_clk_hw_pllv4("spll", "spll_pre_div", base + 0x600); /* APLL PFDs */ - clks[IMX7ULP_CLK_APLL_PFD0] = imx_clk_pfdv2("apll_pfd0", "apll", base + 0x50c, 0); - clks[IMX7ULP_CLK_APLL_PFD1] = imx_clk_pfdv2("apll_pfd1", "apll", base + 0x50c, 1); - clks[IMX7ULP_CLK_APLL_PFD2] = imx_clk_pfdv2("apll_pfd2", "apll", base + 0x50c, 2); - clks[IMX7ULP_CLK_APLL_PFD3] = imx_clk_pfdv2("apll_pfd3", "apll", base + 0x50c, 3); + clks[IMX7ULP_CLK_APLL_PFD0] = imx_clk_hw_pfdv2("apll_pfd0", "apll", base + 0x50c, 0); + clks[IMX7ULP_CLK_APLL_PFD1] = imx_clk_hw_pfdv2("apll_pfd1", "apll", base + 0x50c, 1); + clks[IMX7ULP_CLK_APLL_PFD2] = imx_clk_hw_pfdv2("apll_pfd2", "apll", base + 0x50c, 2); + clks[IMX7ULP_CLK_APLL_PFD3] = imx_clk_hw_pfdv2("apll_pfd3", "apll", base + 0x50c, 3); /* SPLL PFDs */ - clks[IMX7ULP_CLK_SPLL_PFD0] = imx_clk_pfdv2("spll_pfd0", "spll", base + 0x60C, 0); - clks[IMX7ULP_CLK_SPLL_PFD1] = imx_clk_pfdv2("spll_pfd1", "spll", base + 0x60C, 1); - clks[IMX7ULP_CLK_SPLL_PFD2] = imx_clk_pfdv2("spll_pfd2", "spll", base + 0x60C, 2); - clks[IMX7ULP_CLK_SPLL_PFD3] = imx_clk_pfdv2("spll_pfd3", "spll", base + 0x60C, 3); + clks[IMX7ULP_CLK_SPLL_PFD0] = imx_clk_hw_pfdv2("spll_pfd0", "spll", base + 0x60C, 0); + clks[IMX7ULP_CLK_SPLL_PFD1] = imx_clk_hw_pfdv2("spll_pfd1", "spll", base + 0x60C, 1); + clks[IMX7ULP_CLK_SPLL_PFD2] = imx_clk_hw_pfdv2("spll_pfd2", "spll", base + 0x60C, 2); + clks[IMX7ULP_CLK_SPLL_PFD3] = imx_clk_hw_pfdv2("spll_pfd3", "spll", base + 0x60C, 3); /* PLL Mux */ clks[IMX7ULP_CLK_APLL_PFD_SEL] = imx_clk_hw_mux_flags("apll_pfd_sel", base + 0x508, 14, 2, apll_pfd_sels, ARRAY_SIZE(apll_pfd_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE); diff --git a/drivers/clk/imx/clk-pfdv2.c b/drivers/clk/imx/clk-pfdv2.c index a03bbed..de93ce7 100644 --- a/drivers/clk/imx/clk-pfdv2.c +++ b/drivers/clk/imx/clk-pfdv2.c @@ -166,7 +166,7 @@ static const struct clk_ops clk_pfdv2_ops = { .is_enabled = clk_pfdv2_is_enabled, }; -struct clk_hw *imx_clk_pfdv2(const char *name, const char *parent_name, +struct clk_hw *imx_clk_hw_pfdv2(const char *name, const char *parent_name, void __iomem *reg, u8 idx) { struct clk_init_data init; diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 5ca4615..c9f626e 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -199,7 +199,7 @@ struct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent, struct clk_hw *imx_clk_hw_pfd(const char *name, const char *parent_name, void __iomem *reg, u8 idx); -struct clk_hw *imx_clk_pfdv2(const char *name, const char *parent_name, +struct clk_hw *imx_clk_hw_pfdv2(const char *name, const char *parent_name, void __iomem *reg, u8 idx); struct clk_hw *imx_clk_hw_busy_divider(const char *name, const char *parent_name, From patchwork Fri Nov 22 10:48:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11257683 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB0016C1 for ; Fri, 22 Nov 2019 10:48:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A0CC120715 for ; Fri, 22 Nov 2019 10:48:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="mXXF+LWd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728945AbfKVKs3 (ORCPT ); Fri, 22 Nov 2019 05:48:29 -0500 Received: from mail-eopbgr60040.outbound.protection.outlook.com ([40.107.6.40]:54809 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729436AbfKVKs3 (ORCPT ); Fri, 22 Nov 2019 05:48:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FYpU/1zeYYaLbkAjSAg6Xpu7uEj+io/JKROx5vpfPHnL0ZLMpAn08nUnUdsOgS3hULSmBeg8vHgdrFCVsfLMdQJcFUV62jeL2I5rPI/izRFj5NcFt//kvA2YOPPKVy3+p2Zj+COtHXe8kECCAVXfqO6M9arXUVnSPdMHPnlCszkcvq0502pGIA3xt5C0hJjyCiksJ8Pv4elLO6ng8zC/NSBmSjRzPZ+bPooe5n0Y4gR8gI7esTiuoQo9vkSUUUyAT6C8ivdZXFbCPZ6lVzmEG8bU8NYPEVyPPtCxtVaSl3kGQZh6028O+zSyEADhj63kmPX89rqBonUB0ODOKKybvQ== 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=GXi72J5YNtjeIM9Q9CYHEdM7/7lXpwQrwZq1xG5b5rQ=; b=Wv784Xvu/Hh2qefi65V2GEyVU+pThduWIN57EprBzPmklYOOGKCOhvnoncgzYAquN9QwvqgHCttgS6dfkikY+UsBv14ZMFqvjaBPIxRB7P2/rJ/9nCPnYcIrcr/NAkvwBt7a0yByf5JkbEVnKPtmKotaMbVNzTpUkEdPGrwd6Lil8ftRjRpPmMIKcqSne2KOCAqILCL1k5Jao1BQhltabsaWVkFpjbL90s33FHzKhgikpefTIyO725kjeTft6h7WrTRIRYxVHwIEt5IJ+mQQjAGdoWAps2uenrNcm422Gs2sJjfjY/8gxDrJTo7rlzbk7LIzpO2MnBk+0lH+uPeh1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GXi72J5YNtjeIM9Q9CYHEdM7/7lXpwQrwZq1xG5b5rQ=; b=mXXF+LWdeRO+Xomt3VqdxJNCJnmB5+y/4tjqQl3+1m0iyyWomMlPMazjDbiZ0XOsKmVDSU3YBy4+jUHr9UCuEck+bRdODlbu++YZKNzXTPIXU+dXYIIO1B+T6nDAkcsOdM51LQ4xs0mo9uFGe9AQqEyAR8giUb3ngcQ0TBDhWys= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB6961.eurprd04.prod.outlook.com (52.132.212.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 10:48:20 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde%7]) with mapi id 15.20.2474.019; Fri, 22 Nov 2019 10:48:20 +0000 From: Abel Vesa To: Aisheng Dong , Shawn Guo , Leonard Crestez , Stephen Boyd , Sascha Hauer , Jacky Bai CC: Peng Fan , dl-linux-imx , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Abel Vesa Subject: [PATCH v2 10/11] clk: imx: Rename the imx_clk_divider_gate to imply it's clk_hw based Thread-Topic: [PATCH v2 10/11] clk: imx: Rename the imx_clk_divider_gate to imply it's clk_hw based Thread-Index: AQHVoSJa60rJnfieYEWB/AveoN7W2Q== Date: Fri, 22 Nov 2019 10:48:19 +0000 Message-ID: <1574419679-3813-11-git-send-email-abel.vesa@nxp.com> References: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:208:15::33) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.7.4 authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 740287b7-edf2-487b-acff-08d76f397cc5 x-ms-traffictypediagnostic: AM0PR04MB6961:|AM0PR04MB6961: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1122; x-forefront-prvs: 02296943FF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(136003)(376002)(39860400002)(396003)(346002)(189003)(199004)(186003)(44832011)(446003)(11346002)(2616005)(52116002)(76176011)(66446008)(64756008)(66556008)(66476007)(7736002)(478600001)(6636002)(36756003)(14444005)(5660300002)(6506007)(26005)(2906002)(86362001)(14454004)(102836004)(386003)(305945005)(25786009)(66946007)(256004)(110136005)(8936002)(50226002)(6116002)(316002)(99286004)(54906003)(81166006)(81156014)(8676002)(6436002)(6512007)(4326008)(71190400001)(3846002)(71200400001)(66066001)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB6961;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WyJCDvqKpE3vYso1lRiIEbq+nqDsymUMv712tuv7rhhV7XEULnKYrWdTv+UqEUsGcib+Ppo3LL1cMcOGokTxEcjrIflwoFV2Nn3R4kre6z+0xzB4MkMCkVV/fYGBk8rouPiUdUSTWX0hl7VFIRnCFSDiR0mPuXEl3LmiR+B8zAwh75gcD4bxl/F0MMM74NfjoRFcvolXc3x319OBOjb71Du4bZgTgaWGVqeerAVl+MDF4t9w5vWMcHs+bgKbZN4WIN7ljRX4y6FiiuXCamnXH/Tljw7IxVpdvWSBoYxVXkYWdxuA3czEYT/yz2+dcFy/nvg4yP7vzYHx6CJtZnlr57bMepdQ7h1omlKPufB6R7M8TSMBgV8sczlMdLo+d4WFLrzTaX/gtMAREX3sO7nX3rWG3IYhiEiTrFK+tg2VlpIfwl3j5kl1Vpk983Yg2dYd MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 740287b7-edf2-487b-acff-08d76f397cc5 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2019 10:48:19.5491 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 83ccdoIRkDHzG6zDtMz7l27XI35cui4VpjTD7WuIv90xtbZEZwgLJQsATXMk5dzLKwkx3q/L9KFHrltG9+bSCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6961 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Renaming the imx_clk_divider_gate register function to imx_clk_hw_divider_gate to be more obvious it is clk_hw based. Signed-off-by: Abel Vesa Reviewed-by: Peng Fan --- drivers/clk/imx/clk-divider-gate.c | 2 +- drivers/clk/imx/clk-imx7ulp.c | 8 ++++---- drivers/clk/imx/clk.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/clk/imx/clk-divider-gate.c b/drivers/clk/imx/clk-divider-gate.c index 2a8352a..905aee5 100644 --- a/drivers/clk/imx/clk-divider-gate.c +++ b/drivers/clk/imx/clk-divider-gate.c @@ -173,7 +173,7 @@ static const struct clk_ops clk_divider_gate_ops = { * default as our HW is. Besides that it supports only CLK_DIVIDER_READ_ONLY * flag which can be specified by user flexibly. */ -struct clk_hw *imx_clk_divider_gate(const char *name, const char *parent_name, +struct clk_hw *imx_clk_hw_divider_gate(const char *name, const char *parent_name, unsigned long flags, void __iomem *reg, u8 shift, u8 width, u8 clk_divider_flags, const struct clk_div_table *table, diff --git a/drivers/clk/imx/clk-imx7ulp.c b/drivers/clk/imx/clk-imx7ulp.c index 314f9c2..8657e5f 100644 --- a/drivers/clk/imx/clk-imx7ulp.c +++ b/drivers/clk/imx/clk-imx7ulp.c @@ -111,7 +111,7 @@ static void __init imx7ulp_clk_scg1_init(struct device_node *np) clks[IMX7ULP_CLK_APLL_SEL] = imx_clk_hw_mux_flags("apll_sel", base + 0x508, 1, 1, apll_sels, ARRAY_SIZE(apll_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE); clks[IMX7ULP_CLK_SPLL_SEL] = imx_clk_hw_mux_flags("spll_sel", base + 0x608, 1, 1, spll_sels, ARRAY_SIZE(spll_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE); - clks[IMX7ULP_CLK_SPLL_BUS_CLK] = imx_clk_divider_gate("spll_bus_clk", "spll_sel", CLK_SET_RATE_GATE, base + 0x604, 8, 3, 0, ulp_div_table, &imx_ccm_lock); + clks[IMX7ULP_CLK_SPLL_BUS_CLK] = imx_clk_hw_divider_gate("spll_bus_clk", "spll_sel", CLK_SET_RATE_GATE, base + 0x604, 8, 3, 0, ulp_div_table, &imx_ccm_lock); /* scs/ddr/nic select different clock source requires that clock to be enabled first */ clks[IMX7ULP_CLK_SYS_SEL] = imx_clk_hw_mux2("scs_sel", base + 0x14, 24, 4, scs_sels, ARRAY_SIZE(scs_sels)); @@ -122,7 +122,7 @@ static void __init imx7ulp_clk_scg1_init(struct device_node *np) clks[IMX7ULP_CLK_CORE_DIV] = imx_clk_hw_divider_flags("divcore", "scs_sel", base + 0x14, 16, 4, CLK_SET_RATE_PARENT); clks[IMX7ULP_CLK_HSRUN_CORE_DIV] = imx_clk_hw_divider_flags("hsrun_divcore", "hsrun_scs_sel", base + 0x1c, 16, 4, CLK_SET_RATE_PARENT); - clks[IMX7ULP_CLK_DDR_DIV] = imx_clk_divider_gate("ddr_clk", "ddr_sel", CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, base + 0x30, 0, 3, + clks[IMX7ULP_CLK_DDR_DIV] = imx_clk_hw_divider_gate("ddr_clk", "ddr_sel", CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, base + 0x30, 0, 3, 0, ulp_div_table, &imx_ccm_lock); clks[IMX7ULP_CLK_NIC0_DIV] = imx_clk_hw_divider_flags("nic0_clk", "nic_sel", base + 0x40, 24, 4, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); @@ -131,9 +131,9 @@ static void __init imx7ulp_clk_scg1_init(struct device_node *np) clks[IMX7ULP_CLK_GPU_DIV] = imx_clk_hw_divider("gpu_clk", "nic0_clk", base + 0x40, 20, 4); - clks[IMX7ULP_CLK_SOSC_BUS_CLK] = imx_clk_divider_gate("sosc_bus_clk", "sosc", 0, base + 0x104, 8, 3, + clks[IMX7ULP_CLK_SOSC_BUS_CLK] = imx_clk_hw_divider_gate("sosc_bus_clk", "sosc", 0, base + 0x104, 8, 3, CLK_DIVIDER_READ_ONLY, ulp_div_table, &imx_ccm_lock); - clks[IMX7ULP_CLK_FIRC_BUS_CLK] = imx_clk_divider_gate("firc_bus_clk", "firc", 0, base + 0x304, 8, 3, + clks[IMX7ULP_CLK_FIRC_BUS_CLK] = imx_clk_hw_divider_gate("firc_bus_clk", "firc", 0, base + 0x304, 8, 3, CLK_DIVIDER_READ_ONLY, ulp_div_table, &imx_ccm_lock); imx_check_clk_hws(clks, clk_data->num); diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index c9f626e..a1cb2d5 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -468,7 +468,7 @@ struct clk *imx8m_clk_composite_flags(const char *name, #define imx8m_clk_composite_critical(name, parent_names, reg) \ __imx8m_clk_composite(name, parent_names, reg, CLK_IS_CRITICAL) -struct clk_hw *imx_clk_divider_gate(const char *name, const char *parent_name, +struct clk_hw *imx_clk_hw_divider_gate(const char *name, const char *parent_name, unsigned long flags, void __iomem *reg, u8 shift, u8 width, u8 clk_divider_flags, const struct clk_div_table *table, spinlock_t *lock); From patchwork Fri Nov 22 10:48:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11257685 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC3106C1 for ; Fri, 22 Nov 2019 10:48:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E8A320748 for ; Fri, 22 Nov 2019 10:48:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="S6puZvjQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729506AbfKVKsg (ORCPT ); Fri, 22 Nov 2019 05:48:36 -0500 Received: from mail-eopbgr60040.outbound.protection.outlook.com ([40.107.6.40]:54809 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729949AbfKVKsd (ORCPT ); Fri, 22 Nov 2019 05:48:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IHI4TM/tDnuSfx8JR7J5PsH/LM9bYeZ9+3AG1dnlz2ASX1ZsXDNjYEdLaCpLJqquTV6eUI8LC8J2WHv9Q/JbSNzL47Ugf2Ne5LNhSkR95kMnuW4riTa2FVeYB+70DK4b+sb8Vr5GrY/Oht+bG8Nuob+SeUa16Yl+hY0ovX7Oq8ao2subkZ0vZUeYP9D533JrmyMIiBnE6ewLNfJML4tp5+3BEABROTNVGYM25/6bOLon6qcfNs0pHC6rOIjoTdU2M8HDviqvqt+Vf4tXL/A4LxI5tQefMGwIljxQDx1YULBVv3UXRNAm+FYPEqUTqLvEcg9YL9wavOfzRbjEudWBvA== 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=MMajijaU1mWCQuzZyaLeL4+NGf1rQhum5yZ7QNO5xdE=; b=KBbiMxTMcrTZ4aTUbhO1jD6lJt6ys3wA2fb7/hbhp1atrXgCgMWcJaBGtk6gZYKVjJX4RUisg5gjAyLoaiTuUCirOEc30m/KPkKg6XGtKZkfnuXJiSROAFYzJAOZ0Acq6/ickqr48lpe9SGKlgO/57fvgg88KX4VKKQQrSIy5Bmt0eTbrDdgjlsBDmTom5smoXHKiXrEIgeO+kQUsJ/D8JvU9psZrSV+ogjt4E9viAlXdiuAbHGqUQ6J+2Tz2Frmui2qcSeDin1oyJ2k/3544xkwlIgKN+QJidFeB4tD748/KT3ZbQYxqYethk6TQgNmP3pz2ku1B5ZJqwQaZnu8oA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MMajijaU1mWCQuzZyaLeL4+NGf1rQhum5yZ7QNO5xdE=; b=S6puZvjQim6UZO9T5v20D/Uo43bcpH1ZSbD1urAkYmUknvoR9kGlC/R89TQ2ZPjjZYyyotLRZGfctOJ1ivTu25PVZ6CZAWTDAX7g0lgO2OqKsc9d/cqwi6UqqkMLsIBO7z95+fHugByp8Xr48CQm4iSie89hxIjGISPjCkGGuOc= Received: from AM0PR04MB5779.eurprd04.prod.outlook.com (20.178.202.151) by AM0PR04MB6961.eurprd04.prod.outlook.com (52.132.212.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Fri, 22 Nov 2019 10:48:21 +0000 Received: from AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde]) by AM0PR04MB5779.eurprd04.prod.outlook.com ([fe80::fd44:1b14:587c:9fde%7]) with mapi id 15.20.2474.019; Fri, 22 Nov 2019 10:48:21 +0000 From: Abel Vesa To: Aisheng Dong , Shawn Guo , Leonard Crestez , Stephen Boyd , Sascha Hauer , Jacky Bai CC: Peng Fan , dl-linux-imx , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Abel Vesa Subject: [PATCH v2 11/11] clk: imx7up: Rename the clks to hws Thread-Topic: [PATCH v2 11/11] clk: imx7up: Rename the clks to hws Thread-Index: AQHVoSJawgaJ+/TOskyDLHEU1LHdUw== Date: Fri, 22 Nov 2019 10:48:20 +0000 Message-ID: <1574419679-3813-12-git-send-email-abel.vesa@nxp.com> References: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> In-Reply-To: <1574419679-3813-1-git-send-email-abel.vesa@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:208:15::33) To AM0PR04MB5779.eurprd04.prod.outlook.com (2603:10a6:208:131::23) x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.7.4 authentication-results: spf=none (sender IP is ) smtp.mailfrom=abel.vesa@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 977f7c50-4344-4a22-d5d1-08d76f397d61 x-ms-traffictypediagnostic: AM0PR04MB6961:|AM0PR04MB6961: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2043; x-forefront-prvs: 02296943FF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(136003)(376002)(39860400002)(396003)(346002)(189003)(199004)(186003)(44832011)(446003)(11346002)(2616005)(52116002)(76176011)(66446008)(64756008)(66556008)(66476007)(7736002)(478600001)(6636002)(36756003)(14444005)(5660300002)(6506007)(26005)(2906002)(86362001)(14454004)(102836004)(386003)(305945005)(25786009)(66946007)(30864003)(256004)(110136005)(8936002)(50226002)(6116002)(316002)(99286004)(54906003)(81166006)(81156014)(8676002)(6436002)(6512007)(4326008)(71190400001)(3846002)(71200400001)(66066001)(6486002)(579004);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB6961;H:AM0PR04MB5779.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AbKld8yordhIxtxjdFONRAboCudqx9f7PY6lRr+lz1xlRlbO4EJEjJ/zxKKasahbLdavyw7iG8mrRVR24vexOEiw0LUqBbvH393e7wYNtbum69eeElWY6HIexmac0SeLccU5WtlsZMkk6OY4Qe+LfHGDvsHkL6f6cwcCKqET0yD4LdL1IdqnOuFAZnKpOe2bEZIXSJVK+EbOXNTLL89DmEgemahOUFYyI/dt0ujfQMB1W+09oHxatna2HmiesQecoL76H6QMpQ3ArcPjJk94rafMfbUIij8WocsMVM/DKVYuZrpedsg5CXOW07sB3kUu6hzc3F8D2wV0KHuPaKtzgsGnIxAdlkLcj5ket0DLFF1aVNyYgrkWC7CvprVHQpp0fj9E8xoZN8jlQwG+7T66NiLf1vd2I/HoOzB3H/1tweKueJI1UWyELB2gcLpiorXS MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 977f7c50-4344-4a22-d5d1-08d76f397d61 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2019 10:48:20.6185 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: bqqomdGHtb474X6NAmyLOABchKxHuSR6ifUpc1SMOoYjz1FDSpXd60Hg59MHwmprMG1dGakHSx5WLuWTvMT4qQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6961 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org This is just to keep in line with the other i.MX clock drivers that are clk_hw based. Plus, it makes more sense to be called hws since its type is clk_hw not clk. Signed-off-by: Abel Vesa Reviewed-by: Peng Fan --- drivers/clk/imx/clk-imx7ulp.c | 182 +++++++++++++++++++++--------------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/drivers/clk/imx/clk-imx7ulp.c b/drivers/clk/imx/clk-imx7ulp.c index 8657e5f..8f67e49 100644 --- a/drivers/clk/imx/clk-imx7ulp.c +++ b/drivers/clk/imx/clk-imx7ulp.c @@ -58,7 +58,7 @@ static struct clk **pcc3_uart_clks[ARRAY_SIZE(pcc3_uart_clk_ids) + 1] __initdata static void __init imx7ulp_clk_scg1_init(struct device_node *np) { struct clk_hw_onecell_data *clk_data; - struct clk_hw **clks; + struct clk_hw **hws; void __iomem *base; clk_data = kzalloc(struct_size(clk_data, hws, IMX7ULP_CLK_SCG1_END), @@ -67,76 +67,76 @@ static void __init imx7ulp_clk_scg1_init(struct device_node *np) return; clk_data->num = IMX7ULP_CLK_SCG1_END; - clks = clk_data->hws; + hws = clk_data->hws; - clks[IMX7ULP_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0); + hws[IMX7ULP_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0); - clks[IMX7ULP_CLK_ROSC] = imx_obtain_fixed_clk_hw(np, "rosc"); - clks[IMX7ULP_CLK_SOSC] = imx_obtain_fixed_clk_hw(np, "sosc"); - clks[IMX7ULP_CLK_SIRC] = imx_obtain_fixed_clk_hw(np, "sirc"); - clks[IMX7ULP_CLK_FIRC] = imx_obtain_fixed_clk_hw(np, "firc"); - clks[IMX7ULP_CLK_UPLL] = imx_obtain_fixed_clk_hw(np, "upll"); + hws[IMX7ULP_CLK_ROSC] = imx_obtain_fixed_clk_hw(np, "rosc"); + hws[IMX7ULP_CLK_SOSC] = imx_obtain_fixed_clk_hw(np, "sosc"); + hws[IMX7ULP_CLK_SIRC] = imx_obtain_fixed_clk_hw(np, "sirc"); + hws[IMX7ULP_CLK_FIRC] = imx_obtain_fixed_clk_hw(np, "firc"); + hws[IMX7ULP_CLK_UPLL] = imx_obtain_fixed_clk_hw(np, "upll"); /* SCG1 */ base = of_iomap(np, 0); WARN_ON(!base); /* NOTE: xPLL config can't be changed when xPLL is enabled */ - clks[IMX7ULP_CLK_APLL_PRE_SEL] = imx_clk_hw_mux_flags("apll_pre_sel", base + 0x508, 0, 1, pll_pre_sels, ARRAY_SIZE(pll_pre_sels), CLK_SET_PARENT_GATE); - clks[IMX7ULP_CLK_SPLL_PRE_SEL] = imx_clk_hw_mux_flags("spll_pre_sel", base + 0x608, 0, 1, pll_pre_sels, ARRAY_SIZE(pll_pre_sels), CLK_SET_PARENT_GATE); + hws[IMX7ULP_CLK_APLL_PRE_SEL] = imx_clk_hw_mux_flags("apll_pre_sel", base + 0x508, 0, 1, pll_pre_sels, ARRAY_SIZE(pll_pre_sels), CLK_SET_PARENT_GATE); + hws[IMX7ULP_CLK_SPLL_PRE_SEL] = imx_clk_hw_mux_flags("spll_pre_sel", base + 0x608, 0, 1, pll_pre_sels, ARRAY_SIZE(pll_pre_sels), CLK_SET_PARENT_GATE); /* name parent_name reg shift width flags */ - clks[IMX7ULP_CLK_APLL_PRE_DIV] = imx_clk_hw_divider_flags("apll_pre_div", "apll_pre_sel", base + 0x508, 8, 3, CLK_SET_RATE_GATE); - clks[IMX7ULP_CLK_SPLL_PRE_DIV] = imx_clk_hw_divider_flags("spll_pre_div", "spll_pre_sel", base + 0x608, 8, 3, CLK_SET_RATE_GATE); + hws[IMX7ULP_CLK_APLL_PRE_DIV] = imx_clk_hw_divider_flags("apll_pre_div", "apll_pre_sel", base + 0x508, 8, 3, CLK_SET_RATE_GATE); + hws[IMX7ULP_CLK_SPLL_PRE_DIV] = imx_clk_hw_divider_flags("spll_pre_div", "spll_pre_sel", base + 0x608, 8, 3, CLK_SET_RATE_GATE); /* name parent_name base */ - clks[IMX7ULP_CLK_APLL] = imx_clk_hw_pllv4("apll", "apll_pre_div", base + 0x500); - clks[IMX7ULP_CLK_SPLL] = imx_clk_hw_pllv4("spll", "spll_pre_div", base + 0x600); + hws[IMX7ULP_CLK_APLL] = imx_clk_hw_pllv4("apll", "apll_pre_div", base + 0x500); + hws[IMX7ULP_CLK_SPLL] = imx_clk_hw_pllv4("spll", "spll_pre_div", base + 0x600); /* APLL PFDs */ - clks[IMX7ULP_CLK_APLL_PFD0] = imx_clk_hw_pfdv2("apll_pfd0", "apll", base + 0x50c, 0); - clks[IMX7ULP_CLK_APLL_PFD1] = imx_clk_hw_pfdv2("apll_pfd1", "apll", base + 0x50c, 1); - clks[IMX7ULP_CLK_APLL_PFD2] = imx_clk_hw_pfdv2("apll_pfd2", "apll", base + 0x50c, 2); - clks[IMX7ULP_CLK_APLL_PFD3] = imx_clk_hw_pfdv2("apll_pfd3", "apll", base + 0x50c, 3); + hws[IMX7ULP_CLK_APLL_PFD0] = imx_clk_hw_pfdv2("apll_pfd0", "apll", base + 0x50c, 0); + hws[IMX7ULP_CLK_APLL_PFD1] = imx_clk_hw_pfdv2("apll_pfd1", "apll", base + 0x50c, 1); + hws[IMX7ULP_CLK_APLL_PFD2] = imx_clk_hw_pfdv2("apll_pfd2", "apll", base + 0x50c, 2); + hws[IMX7ULP_CLK_APLL_PFD3] = imx_clk_hw_pfdv2("apll_pfd3", "apll", base + 0x50c, 3); /* SPLL PFDs */ - clks[IMX7ULP_CLK_SPLL_PFD0] = imx_clk_hw_pfdv2("spll_pfd0", "spll", base + 0x60C, 0); - clks[IMX7ULP_CLK_SPLL_PFD1] = imx_clk_hw_pfdv2("spll_pfd1", "spll", base + 0x60C, 1); - clks[IMX7ULP_CLK_SPLL_PFD2] = imx_clk_hw_pfdv2("spll_pfd2", "spll", base + 0x60C, 2); - clks[IMX7ULP_CLK_SPLL_PFD3] = imx_clk_hw_pfdv2("spll_pfd3", "spll", base + 0x60C, 3); + hws[IMX7ULP_CLK_SPLL_PFD0] = imx_clk_hw_pfdv2("spll_pfd0", "spll", base + 0x60C, 0); + hws[IMX7ULP_CLK_SPLL_PFD1] = imx_clk_hw_pfdv2("spll_pfd1", "spll", base + 0x60C, 1); + hws[IMX7ULP_CLK_SPLL_PFD2] = imx_clk_hw_pfdv2("spll_pfd2", "spll", base + 0x60C, 2); + hws[IMX7ULP_CLK_SPLL_PFD3] = imx_clk_hw_pfdv2("spll_pfd3", "spll", base + 0x60C, 3); /* PLL Mux */ - clks[IMX7ULP_CLK_APLL_PFD_SEL] = imx_clk_hw_mux_flags("apll_pfd_sel", base + 0x508, 14, 2, apll_pfd_sels, ARRAY_SIZE(apll_pfd_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE); - clks[IMX7ULP_CLK_SPLL_PFD_SEL] = imx_clk_hw_mux_flags("spll_pfd_sel", base + 0x608, 14, 2, spll_pfd_sels, ARRAY_SIZE(spll_pfd_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE); - clks[IMX7ULP_CLK_APLL_SEL] = imx_clk_hw_mux_flags("apll_sel", base + 0x508, 1, 1, apll_sels, ARRAY_SIZE(apll_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE); - clks[IMX7ULP_CLK_SPLL_SEL] = imx_clk_hw_mux_flags("spll_sel", base + 0x608, 1, 1, spll_sels, ARRAY_SIZE(spll_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE); + hws[IMX7ULP_CLK_APLL_PFD_SEL] = imx_clk_hw_mux_flags("apll_pfd_sel", base + 0x508, 14, 2, apll_pfd_sels, ARRAY_SIZE(apll_pfd_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE); + hws[IMX7ULP_CLK_SPLL_PFD_SEL] = imx_clk_hw_mux_flags("spll_pfd_sel", base + 0x608, 14, 2, spll_pfd_sels, ARRAY_SIZE(spll_pfd_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE); + hws[IMX7ULP_CLK_APLL_SEL] = imx_clk_hw_mux_flags("apll_sel", base + 0x508, 1, 1, apll_sels, ARRAY_SIZE(apll_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE); + hws[IMX7ULP_CLK_SPLL_SEL] = imx_clk_hw_mux_flags("spll_sel", base + 0x608, 1, 1, spll_sels, ARRAY_SIZE(spll_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE); - clks[IMX7ULP_CLK_SPLL_BUS_CLK] = imx_clk_hw_divider_gate("spll_bus_clk", "spll_sel", CLK_SET_RATE_GATE, base + 0x604, 8, 3, 0, ulp_div_table, &imx_ccm_lock); + hws[IMX7ULP_CLK_SPLL_BUS_CLK] = imx_clk_hw_divider_gate("spll_bus_clk", "spll_sel", CLK_SET_RATE_GATE, base + 0x604, 8, 3, 0, ulp_div_table, &imx_ccm_lock); /* scs/ddr/nic select different clock source requires that clock to be enabled first */ - clks[IMX7ULP_CLK_SYS_SEL] = imx_clk_hw_mux2("scs_sel", base + 0x14, 24, 4, scs_sels, ARRAY_SIZE(scs_sels)); - clks[IMX7ULP_CLK_HSRUN_SYS_SEL] = imx_clk_hw_mux2("hsrun_scs_sel", base + 0x1c, 24, 4, scs_sels, ARRAY_SIZE(scs_sels)); - clks[IMX7ULP_CLK_NIC_SEL] = imx_clk_hw_mux2("nic_sel", base + 0x40, 28, 1, nic_sels, ARRAY_SIZE(nic_sels)); - clks[IMX7ULP_CLK_DDR_SEL] = imx_clk_hw_mux_flags("ddr_sel", base + 0x30, 24, 2, ddr_sels, ARRAY_SIZE(ddr_sels), CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE); + hws[IMX7ULP_CLK_SYS_SEL] = imx_clk_hw_mux2("scs_sel", base + 0x14, 24, 4, scs_sels, ARRAY_SIZE(scs_sels)); + hws[IMX7ULP_CLK_HSRUN_SYS_SEL] = imx_clk_hw_mux2("hsrun_scs_sel", base + 0x1c, 24, 4, scs_sels, ARRAY_SIZE(scs_sels)); + hws[IMX7ULP_CLK_NIC_SEL] = imx_clk_hw_mux2("nic_sel", base + 0x40, 28, 1, nic_sels, ARRAY_SIZE(nic_sels)); + hws[IMX7ULP_CLK_DDR_SEL] = imx_clk_hw_mux_flags("ddr_sel", base + 0x30, 24, 2, ddr_sels, ARRAY_SIZE(ddr_sels), CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE); - clks[IMX7ULP_CLK_CORE_DIV] = imx_clk_hw_divider_flags("divcore", "scs_sel", base + 0x14, 16, 4, CLK_SET_RATE_PARENT); - clks[IMX7ULP_CLK_HSRUN_CORE_DIV] = imx_clk_hw_divider_flags("hsrun_divcore", "hsrun_scs_sel", base + 0x1c, 16, 4, CLK_SET_RATE_PARENT); + hws[IMX7ULP_CLK_CORE_DIV] = imx_clk_hw_divider_flags("divcore", "scs_sel", base + 0x14, 16, 4, CLK_SET_RATE_PARENT); + hws[IMX7ULP_CLK_HSRUN_CORE_DIV] = imx_clk_hw_divider_flags("hsrun_divcore", "hsrun_scs_sel", base + 0x1c, 16, 4, CLK_SET_RATE_PARENT); - clks[IMX7ULP_CLK_DDR_DIV] = imx_clk_hw_divider_gate("ddr_clk", "ddr_sel", CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, base + 0x30, 0, 3, + hws[IMX7ULP_CLK_DDR_DIV] = imx_clk_hw_divider_gate("ddr_clk", "ddr_sel", CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, base + 0x30, 0, 3, 0, ulp_div_table, &imx_ccm_lock); - clks[IMX7ULP_CLK_NIC0_DIV] = imx_clk_hw_divider_flags("nic0_clk", "nic_sel", base + 0x40, 24, 4, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); - clks[IMX7ULP_CLK_NIC1_DIV] = imx_clk_hw_divider_flags("nic1_clk", "nic0_clk", base + 0x40, 16, 4, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); - clks[IMX7ULP_CLK_NIC1_BUS_DIV] = imx_clk_hw_divider_flags("nic1_bus_clk", "nic0_clk", base + 0x40, 4, 4, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); + hws[IMX7ULP_CLK_NIC0_DIV] = imx_clk_hw_divider_flags("nic0_clk", "nic_sel", base + 0x40, 24, 4, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); + hws[IMX7ULP_CLK_NIC1_DIV] = imx_clk_hw_divider_flags("nic1_clk", "nic0_clk", base + 0x40, 16, 4, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); + hws[IMX7ULP_CLK_NIC1_BUS_DIV] = imx_clk_hw_divider_flags("nic1_bus_clk", "nic0_clk", base + 0x40, 4, 4, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); - clks[IMX7ULP_CLK_GPU_DIV] = imx_clk_hw_divider("gpu_clk", "nic0_clk", base + 0x40, 20, 4); + hws[IMX7ULP_CLK_GPU_DIV] = imx_clk_hw_divider("gpu_clk", "nic0_clk", base + 0x40, 20, 4); - clks[IMX7ULP_CLK_SOSC_BUS_CLK] = imx_clk_hw_divider_gate("sosc_bus_clk", "sosc", 0, base + 0x104, 8, 3, + hws[IMX7ULP_CLK_SOSC_BUS_CLK] = imx_clk_hw_divider_gate("sosc_bus_clk", "sosc", 0, base + 0x104, 8, 3, CLK_DIVIDER_READ_ONLY, ulp_div_table, &imx_ccm_lock); - clks[IMX7ULP_CLK_FIRC_BUS_CLK] = imx_clk_hw_divider_gate("firc_bus_clk", "firc", 0, base + 0x304, 8, 3, + hws[IMX7ULP_CLK_FIRC_BUS_CLK] = imx_clk_hw_divider_gate("firc_bus_clk", "firc", 0, base + 0x304, 8, 3, CLK_DIVIDER_READ_ONLY, ulp_div_table, &imx_ccm_lock); - imx_check_clk_hws(clks, clk_data->num); + imx_check_clk_hws(hws, clk_data->num); of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); } @@ -145,7 +145,7 @@ CLK_OF_DECLARE(imx7ulp_clk_scg1, "fsl,imx7ulp-scg1", imx7ulp_clk_scg1_init); static void __init imx7ulp_clk_pcc2_init(struct device_node *np) { struct clk_hw_onecell_data *clk_data; - struct clk_hw **clks; + struct clk_hw **hws; void __iomem *base; int i; @@ -155,42 +155,42 @@ static void __init imx7ulp_clk_pcc2_init(struct device_node *np) return; clk_data->num = IMX7ULP_CLK_PCC2_END; - clks = clk_data->hws; + hws = clk_data->hws; /* PCC2 */ base = of_iomap(np, 0); WARN_ON(!base); - clks[IMX7ULP_CLK_DMA1] = imx_clk_hw_gate("dma1", "nic1_clk", base + 0x20, 30); - clks[IMX7ULP_CLK_RGPIO2P1] = imx_clk_hw_gate("rgpio2p1", "nic1_bus_clk", base + 0x3c, 30); - clks[IMX7ULP_CLK_DMA_MUX1] = imx_clk_hw_gate("dma_mux1", "nic1_bus_clk", base + 0x84, 30); - clks[IMX7ULP_CLK_CAAM] = imx_clk_hw_gate("caam", "nic1_clk", base + 0x90, 30); - clks[IMX7ULP_CLK_LPTPM4] = imx7ulp_clk_hw_composite("lptpm4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x94); - clks[IMX7ULP_CLK_LPTPM5] = imx7ulp_clk_hw_composite("lptpm5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x98); - clks[IMX7ULP_CLK_LPIT1] = imx7ulp_clk_hw_composite("lpit1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x9c); - clks[IMX7ULP_CLK_LPSPI2] = imx7ulp_clk_hw_composite("lpspi2", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xa4); - clks[IMX7ULP_CLK_LPSPI3] = imx7ulp_clk_hw_composite("lpspi3", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xa8); - clks[IMX7ULP_CLK_LPI2C4] = imx7ulp_clk_hw_composite("lpi2c4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xac); - clks[IMX7ULP_CLK_LPI2C5] = imx7ulp_clk_hw_composite("lpi2c5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb0); - clks[IMX7ULP_CLK_LPUART4] = imx7ulp_clk_hw_composite("lpuart4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb4); - clks[IMX7ULP_CLK_LPUART5] = imx7ulp_clk_hw_composite("lpuart5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb8); - clks[IMX7ULP_CLK_FLEXIO1] = imx7ulp_clk_hw_composite("flexio1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xc4); - clks[IMX7ULP_CLK_USB0] = imx7ulp_clk_hw_composite("usb0", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xcc); - clks[IMX7ULP_CLK_USB1] = imx7ulp_clk_hw_composite("usb1", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xd0); - clks[IMX7ULP_CLK_USB_PHY] = imx_clk_hw_gate("usb_phy", "nic1_bus_clk", base + 0xd4, 30); - clks[IMX7ULP_CLK_USDHC0] = imx7ulp_clk_hw_composite("usdhc0", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xdc); - clks[IMX7ULP_CLK_USDHC1] = imx7ulp_clk_hw_composite("usdhc1", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xe0); - clks[IMX7ULP_CLK_WDG1] = imx7ulp_clk_hw_composite("wdg1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0xf4); - clks[IMX7ULP_CLK_WDG2] = imx7ulp_clk_hw_composite("sdg2", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0x10c); - - imx_check_clk_hws(clks, clk_data->num); + hws[IMX7ULP_CLK_DMA1] = imx_clk_hw_gate("dma1", "nic1_clk", base + 0x20, 30); + hws[IMX7ULP_CLK_RGPIO2P1] = imx_clk_hw_gate("rgpio2p1", "nic1_bus_clk", base + 0x3c, 30); + hws[IMX7ULP_CLK_DMA_MUX1] = imx_clk_hw_gate("dma_mux1", "nic1_bus_clk", base + 0x84, 30); + hws[IMX7ULP_CLK_CAAM] = imx_clk_hw_gate("caam", "nic1_clk", base + 0x90, 30); + hws[IMX7ULP_CLK_LPTPM4] = imx7ulp_clk_hw_composite("lptpm4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x94); + hws[IMX7ULP_CLK_LPTPM5] = imx7ulp_clk_hw_composite("lptpm5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x98); + hws[IMX7ULP_CLK_LPIT1] = imx7ulp_clk_hw_composite("lpit1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x9c); + hws[IMX7ULP_CLK_LPSPI2] = imx7ulp_clk_hw_composite("lpspi2", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xa4); + hws[IMX7ULP_CLK_LPSPI3] = imx7ulp_clk_hw_composite("lpspi3", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xa8); + hws[IMX7ULP_CLK_LPI2C4] = imx7ulp_clk_hw_composite("lpi2c4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xac); + hws[IMX7ULP_CLK_LPI2C5] = imx7ulp_clk_hw_composite("lpi2c5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb0); + hws[IMX7ULP_CLK_LPUART4] = imx7ulp_clk_hw_composite("lpuart4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb4); + hws[IMX7ULP_CLK_LPUART5] = imx7ulp_clk_hw_composite("lpuart5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xb8); + hws[IMX7ULP_CLK_FLEXIO1] = imx7ulp_clk_hw_composite("flexio1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0xc4); + hws[IMX7ULP_CLK_USB0] = imx7ulp_clk_hw_composite("usb0", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xcc); + hws[IMX7ULP_CLK_USB1] = imx7ulp_clk_hw_composite("usb1", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xd0); + hws[IMX7ULP_CLK_USB_PHY] = imx_clk_hw_gate("usb_phy", "nic1_bus_clk", base + 0xd4, 30); + hws[IMX7ULP_CLK_USDHC0] = imx7ulp_clk_hw_composite("usdhc0", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xdc); + hws[IMX7ULP_CLK_USDHC1] = imx7ulp_clk_hw_composite("usdhc1", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xe0); + hws[IMX7ULP_CLK_WDG1] = imx7ulp_clk_hw_composite("wdg1", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0xf4); + hws[IMX7ULP_CLK_WDG2] = imx7ulp_clk_hw_composite("sdg2", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0x10c); + + imx_check_clk_hws(hws, clk_data->num); of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); for (i = 0; i < ARRAY_SIZE(pcc2_uart_clk_ids); i++) { int index = pcc2_uart_clk_ids[i]; - pcc2_uart_clks[i] = &clks[index]->clk; + pcc2_uart_clks[i] = &hws[index]->clk; } imx_register_uart_clocks(pcc2_uart_clks); @@ -200,7 +200,7 @@ CLK_OF_DECLARE(imx7ulp_clk_pcc2, "fsl,imx7ulp-pcc2", imx7ulp_clk_pcc2_init); static void __init imx7ulp_clk_pcc3_init(struct device_node *np) { struct clk_hw_onecell_data *clk_data; - struct clk_hw **clks; + struct clk_hw **hws; void __iomem *base; int i; @@ -210,41 +210,41 @@ static void __init imx7ulp_clk_pcc3_init(struct device_node *np) return; clk_data->num = IMX7ULP_CLK_PCC3_END; - clks = clk_data->hws; + hws = clk_data->hws; /* PCC3 */ base = of_iomap(np, 0); WARN_ON(!base); - clks[IMX7ULP_CLK_LPTPM6] = imx7ulp_clk_hw_composite("lptpm6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x84); - clks[IMX7ULP_CLK_LPTPM7] = imx7ulp_clk_hw_composite("lptpm7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x88); + hws[IMX7ULP_CLK_LPTPM6] = imx7ulp_clk_hw_composite("lptpm6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x84); + hws[IMX7ULP_CLK_LPTPM7] = imx7ulp_clk_hw_composite("lptpm7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x88); - clks[IMX7ULP_CLK_MMDC] = clk_hw_register_gate(NULL, "mmdc", "nic1_clk", CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, + hws[IMX7ULP_CLK_MMDC] = clk_hw_register_gate(NULL, "mmdc", "nic1_clk", CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, base + 0xac, 30, 0, &imx_ccm_lock); - clks[IMX7ULP_CLK_LPI2C6] = imx7ulp_clk_hw_composite("lpi2c6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x90); - clks[IMX7ULP_CLK_LPI2C7] = imx7ulp_clk_hw_composite("lpi2c7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x94); - clks[IMX7ULP_CLK_LPUART6] = imx7ulp_clk_hw_composite("lpuart6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x98); - clks[IMX7ULP_CLK_LPUART7] = imx7ulp_clk_hw_composite("lpuart7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x9c); - clks[IMX7ULP_CLK_DSI] = imx7ulp_clk_hw_composite("dsi", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0xa4); - clks[IMX7ULP_CLK_LCDIF] = imx7ulp_clk_hw_composite("lcdif", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xa8); + hws[IMX7ULP_CLK_LPI2C6] = imx7ulp_clk_hw_composite("lpi2c6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x90); + hws[IMX7ULP_CLK_LPI2C7] = imx7ulp_clk_hw_composite("lpi2c7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x94); + hws[IMX7ULP_CLK_LPUART6] = imx7ulp_clk_hw_composite("lpuart6", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x98); + hws[IMX7ULP_CLK_LPUART7] = imx7ulp_clk_hw_composite("lpuart7", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x9c); + hws[IMX7ULP_CLK_DSI] = imx7ulp_clk_hw_composite("dsi", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, true, true, base + 0xa4); + hws[IMX7ULP_CLK_LCDIF] = imx7ulp_clk_hw_composite("lcdif", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, true, true, base + 0xa8); - clks[IMX7ULP_CLK_VIU] = imx_clk_hw_gate("viu", "nic1_clk", base + 0xa0, 30); - clks[IMX7ULP_CLK_PCTLC] = imx_clk_hw_gate("pctlc", "nic1_bus_clk", base + 0xb8, 30); - clks[IMX7ULP_CLK_PCTLD] = imx_clk_hw_gate("pctld", "nic1_bus_clk", base + 0xbc, 30); - clks[IMX7ULP_CLK_PCTLE] = imx_clk_hw_gate("pctle", "nic1_bus_clk", base + 0xc0, 30); - clks[IMX7ULP_CLK_PCTLF] = imx_clk_hw_gate("pctlf", "nic1_bus_clk", base + 0xc4, 30); + hws[IMX7ULP_CLK_VIU] = imx_clk_hw_gate("viu", "nic1_clk", base + 0xa0, 30); + hws[IMX7ULP_CLK_PCTLC] = imx_clk_hw_gate("pctlc", "nic1_bus_clk", base + 0xb8, 30); + hws[IMX7ULP_CLK_PCTLD] = imx_clk_hw_gate("pctld", "nic1_bus_clk", base + 0xbc, 30); + hws[IMX7ULP_CLK_PCTLE] = imx_clk_hw_gate("pctle", "nic1_bus_clk", base + 0xc0, 30); + hws[IMX7ULP_CLK_PCTLF] = imx_clk_hw_gate("pctlf", "nic1_bus_clk", base + 0xc4, 30); - clks[IMX7ULP_CLK_GPU3D] = imx7ulp_clk_hw_composite("gpu3d", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, false, true, base + 0x140); - clks[IMX7ULP_CLK_GPU2D] = imx7ulp_clk_hw_composite("gpu2d", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, false, true, base + 0x144); + hws[IMX7ULP_CLK_GPU3D] = imx7ulp_clk_hw_composite("gpu3d", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, false, true, base + 0x140); + hws[IMX7ULP_CLK_GPU2D] = imx7ulp_clk_hw_composite("gpu2d", periph_plat_sels, ARRAY_SIZE(periph_plat_sels), true, false, true, base + 0x144); - imx_check_clk_hws(clks, clk_data->num); + imx_check_clk_hws(hws, clk_data->num); of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); for (i = 0; i < ARRAY_SIZE(pcc3_uart_clk_ids); i++) { int index = pcc3_uart_clk_ids[i]; - pcc3_uart_clks[i] = &clks[index]->clk; + pcc3_uart_clks[i] = &hws[index]->clk; } imx_register_uart_clocks(pcc3_uart_clks); @@ -254,7 +254,7 @@ CLK_OF_DECLARE(imx7ulp_clk_pcc3, "fsl,imx7ulp-pcc3", imx7ulp_clk_pcc3_init); static void __init imx7ulp_clk_smc1_init(struct device_node *np) { struct clk_hw_onecell_data *clk_data; - struct clk_hw **clks; + struct clk_hw **hws; void __iomem *base; clk_data = kzalloc(struct_size(clk_data, hws, IMX7ULP_CLK_SMC1_END), @@ -263,15 +263,15 @@ static void __init imx7ulp_clk_smc1_init(struct device_node *np) return; clk_data->num = IMX7ULP_CLK_SMC1_END; - clks = clk_data->hws; + hws = clk_data->hws; /* SMC1 */ base = of_iomap(np, 0); WARN_ON(!base); - clks[IMX7ULP_CLK_ARM] = imx_clk_hw_mux_flags("arm", base + 0x10, 8, 2, arm_sels, ARRAY_SIZE(arm_sels), CLK_IS_CRITICAL); + hws[IMX7ULP_CLK_ARM] = imx_clk_hw_mux_flags("arm", base + 0x10, 8, 2, arm_sels, ARRAY_SIZE(arm_sels), CLK_IS_CRITICAL); - imx_check_clk_hws(clks, clk_data->num); + imx_check_clk_hws(hws, clk_data->num); of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); }