From patchwork Wed Nov 21 14:12:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10692615 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ADC8313BB for ; Wed, 21 Nov 2018 14:12:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B6AE2BD4B for ; Wed, 21 Nov 2018 14:12:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F5CD2BD6B; Wed, 21 Nov 2018 14:12:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0C1FF2BD44 for ; Wed, 21 Nov 2018 14:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TH00uy488w/NHHs0a/r8nT9pOMliUp1l62zqGLUE8oY=; b=RcM8BeCI8DNI0h 7u2DsXYN3WQxBTb+FvMIrV70LPQCMsCP4yvw9oht1R9bMut4VnadHL/ZkaMN7NKnq05dYCschAccy YfSmOmwgwrycRmMsFcziHu/4t0UNxKX7kIPqUG7NibGHrLhbOT0jrxuLZYG+Mkk4RnGSIcKS+pzYS 0ijTjAgFCrrjOdMnmN4wsT1v8LLLUmqmUr9gwVyv2yQ4oOH8L6EhNx0lLfO2Cjs6xKtN/fGnTO66V egGj88u6mjheRlpCjVBc+eXhxkX+evYmd1jsDZ4ulP4NpFzRgCof8x3Oe93REPYi3mg2GHk2ttQCV okRm46TYxI9XlXGIOYKg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTFI-00030p-Tn; Wed, 21 Nov 2018 14:12:48 +0000 Received: from mail-eopbgr00088.outbound.protection.outlook.com ([40.107.0.88] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTF7-0002nT-Fl for linux-arm-kernel@lists.infradead.org; Wed, 21 Nov 2018 14:12:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1c070GikEio1iNb+8SkLQXLkoa0GMY/ebCxWMHJttxI=; b=jTG7edkLBEDywYeA/PdMnxq0pagNAQAZATEOk/GNM+BIiPMmjzjB+AStXLbnDXuSozgdVI/H/UqGEGX28e+iWNCsipCnU3at+4kjPTHghCrJLSw3wWXmq6jwT32Yzr2AC5fKXYw6BCBYaQztUnvIaN2fHN2FFmJ7zxSkbPEiX6A= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.126.21) by AM0PR04MB4081.eurprd04.prod.outlook.com (52.134.125.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.23; Wed, 21 Nov 2018 14:12:19 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927%2]) with mapi id 15.20.1339.027; Wed, 21 Nov 2018 14:12:19 +0000 From: Aisheng DONG To: "linux-clk@vger.kernel.org" Subject: [PATCH V8 1/7] clk: imx: add configuration option for mmio clks Thread-Topic: [PATCH V8 1/7] clk: imx: add configuration option for mmio clks Thread-Index: AQHUgaQ2nfeOEC51j024OUxbOU/p9Q== Date: Wed, 21 Nov 2018 14:12:19 +0000 Message-ID: <1542809234-539-2-git-send-email-aisheng.dong@nxp.com> References: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0178.apcprd02.prod.outlook.com (2603:1096:201:21::14) To AM0PR04MB4211.eurprd04.prod.outlook.com (2603:10a6:208:66::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR04MB4081; 6:LDk8BIXzYoEXmlShWiYVePvkOGgweQDHfqD+ysosExr7oV6b+jnkUd8UE6pjgI6+CdAfThkzSX/kS4dz4yQ2esQbfYroIUj1GqUXWtUPQazphRSmx7wZLlDyjbTOiyXVkJFfP7KepoRMUUX4ErRukByKny/ghBgtuPoCNHF7TJ7k5fnua+9bKJkRPYKxcp1kGjOv0GiW3fhd2ejwUVFpu9S064WLU57c7eoYSdE3e1eqh65GyU3B0T6twwBSS1xcdas0GxcMQ1uRe3XljeNMd//Gy6vH4IK7y8oN+Sh7dZ0WfeT9CYb26+79pVIFOS9GxbqnAD0sYAzFmX4scN/nKfPOFtKQyJRn8ip9YtspK7x7pZ88H8ejxpoi+DxoRE8vujZH09N1SqFYXppGvABrRuxqIrzGXM4lsn3VKrKkQXt0bMnMxATz9ZtVMq2wvmU7aZKEISnMGBmww3N2hG1C7g==; 5:ninqqGNkFJkJ+rM0m+jj6jpgYvKkLRks8sTG0tgoqSWd93AdPUPcPf4YXSHCUcQd7uMFNNd2xxKufeLPXCmfmz54lG+m3SMD4KGcLPC6nte5upsDvW9oAPJDTHfQ66Lh42CYFDTA7DYzGUYrU3wfqJ4M0Z4gU8x+uDw5IlJJUzU=; 7:1HLWgVoBwiUKxa33X6fXparn2b+5XOWp3I95DN3b2v3TLDbx0VKZsajMZqTl72Om6yT/mx8pZvk4xdaujloRm/BPFPMfjG9dDc4gPnWfyXuR5BYhSd3RlxqxYkwo26a7/D0img9otytwcwk52JtGEA== x-ms-office365-filtering-correlation-id: 4cb68fd7-e42f-47a1-5696-08d64fbb5931 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB4081; x-ms-traffictypediagnostic: AM0PR04MB4081: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231442)(944501410)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:AM0PR04MB4081; BCL:0; PCL:0; RULEID:; SRVR:AM0PR04MB4081; x-forefront-prvs: 08635C03D4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(346002)(396003)(376002)(39860400002)(366004)(199004)(189003)(6506007)(386003)(54906003)(2900100001)(76176011)(105586002)(66066001)(50226002)(26005)(3846002)(102836004)(2501003)(186003)(6486002)(305945005)(7736002)(4326008)(8676002)(478600001)(68736007)(52116002)(106356001)(2351001)(5660300001)(316002)(14454004)(446003)(6916009)(5640700003)(81156014)(25786009)(2906002)(81166006)(2616005)(476003)(486006)(86362001)(6436002)(6116002)(97736004)(71190400001)(14444005)(11346002)(99286004)(53936002)(6512007)(256004)(8936002)(71200400001)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4081; H:AM0PR04MB4211.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: cM5QEWFJjINHA6mNJBm1nC/Nfi/w749SDeK0yaFpUMCLjic6I2E638mJn/1/9ddzYPmGrAm8pR/oUjqcSI5qOLKiZA6y4s9o6ldTD/MIACuHKkGXB99ftVxHzCXKlLTrv9QluubJFypUOLaLebnK1nOkQd9Xc1hIOWO9SRSzuyDLoo1xTZat7ZSA/xbhOyJfsqDY/7TJ6XulPSqlth4ysVJIVVcLouRUN+SEGF7MbnMkAlBLJe2x3q4DNRX9BxI8/prLnGvs+kFhc9JOjUEfQ7Bghah0UCC61rrNFwLJ5LWBVK+i7l1lT1wa3sfKyL/vzRkuu68Ee909E38U/G3Wss1WDOA/9zeBZp5EK8RbyJw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4cb68fd7-e42f-47a1-5696-08d64fbb5931 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2018 14:12:19.5888 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4081 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181121_061237_521346_43FBF63E X-CRM114-Status: GOOD ( 15.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aisheng DONG , "sboyd@kernel.org" , "mturquette@baylibre.com" , dl-linux-imx , "kernel@pengutronix.de" , Fabio Estevam , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The patch introduces CONFIG_MXC_CLK option for legacy MMIO clocks, this is required to compile legacy MMIO clock conditionally when adding SCU based clocks for MX8 platforms later. Cc: Shawn Guo Cc: Sascha Hauer Cc: Fabio Estevam Cc: Stephen Boyd Cc: Michael Turquette Signed-off-by: Dong Aisheng --- v1->v8: no changes --- arch/arm/mach-imx/Kconfig | 11 +++++++++++ drivers/clk/Kconfig | 1 + drivers/clk/imx/Kconfig | 5 +++++ drivers/clk/imx/Makefile | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/imx/Kconfig diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index abc3371..11a9661 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -57,23 +57,27 @@ config SOC_IMX21 select CPU_ARM926T select IMX_HAVE_IOMUX_V1 select MXC_AVIC + select MXC_CLK config SOC_IMX27 bool select CPU_ARM926T select IMX_HAVE_IOMUX_V1 select MXC_AVIC + select MXC_CLK select PINCTRL_IMX27 config SOC_IMX31 bool select CPU_V6 select MXC_AVIC + select MXC_CLK config SOC_IMX35 bool select ARCH_MXC_IOMUX_V3 select MXC_AVIC + select MXC_CLK select PINCTRL_IMX35 if ARCH_MULTI_V5 @@ -417,6 +421,7 @@ config SOC_IMX1 bool "i.MX1 support" select CPU_ARM920T select MXC_AVIC + select MXC_CLK select PINCTRL_IMX1 help This enables support for Freescale i.MX1 processor @@ -430,6 +435,7 @@ config SOC_IMX25 select ARCH_MXC_IOMUX_V3 select CPU_ARM926T select MXC_AVIC + select MXC_CLK select PINCTRL_IMX25 help This enables support for Freescale i.MX25 processor @@ -442,6 +448,7 @@ comment "Cortex-A platforms" config SOC_IMX5 bool select HAVE_IMX_SRC + select MXC_CLK select MXC_TZIC config SOC_IMX50 @@ -478,6 +485,7 @@ config SOC_IMX6 select HAVE_IMX_MMDC select HAVE_IMX_SRC select MFD_SYSCON + select MXC_CLK select PL310_ERRATA_769419 if CACHE_L2X0 config SOC_IMX6Q @@ -545,10 +553,12 @@ config SOC_IMX7D_CA7 select HAVE_IMX_MMDC select HAVE_IMX_SRC select IMX_GPCV2 + select MXC_CLK config SOC_IMX7D_CM4 bool select ARMV7M_SYSTICK + select MXC_CLK config SOC_IMX7D bool "i.MX7 Dual support" @@ -561,6 +571,7 @@ config SOC_IMX7D config SOC_VF610 bool "Vybrid Family VF610 support" select ARM_GIC if ARCH_MULTI_V7 + select MXC_CLK select PINCTRL_VF610 help diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 292056b..09eba54 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -287,6 +287,7 @@ source "drivers/clk/actions/Kconfig" source "drivers/clk/bcm/Kconfig" source "drivers/clk/hisilicon/Kconfig" source "drivers/clk/imgtec/Kconfig" +source "drivers/clk/imx/Kconfig" source "drivers/clk/keystone/Kconfig" source "drivers/clk/mediatek/Kconfig" source "drivers/clk/meson/Kconfig" diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig new file mode 100644 index 0000000..43a3ecc --- /dev/null +++ b/drivers/clk/imx/Kconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 +# common clock support for NXP i.MX SoC family. +config MXC_CLK + bool + depends on ARCH_MXC diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile index 8c3baa7..d447f8c 100644 --- a/drivers/clk/imx/Makefile +++ b/drivers/clk/imx/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -obj-y += \ +obj-$(CONFIG_MXC_CLK) += \ clk.o \ clk-busy.o \ clk-cpu.o \ From patchwork Wed Nov 21 14:12:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10692621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A852B13BB for ; Wed, 21 Nov 2018 14:13:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93C1D2BCA5 for ; Wed, 21 Nov 2018 14:13:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86F192BD02; Wed, 21 Nov 2018 14:13:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BBA572BCA5 for ; Wed, 21 Nov 2018 14:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9ib4mqluMgXJP71PdN0vA33U2oiZ9lGmTe7jxGZOPfU=; b=NzvQbZ9F5p4ZcD DMHscaC2yJq+8hzdd4rRsPw5N+v74rnDc3MouwYsS/nC0IkTUaaX8TC+qwvyAf9ppQMZQZATQSY+h nNWsvCfAJjAXN53f07THN2w3X/Ej6hNQ3awWRCJO6lQgKAmKCIu+Dz0yu//Un7qa2jZscuP0HEb06 Z8GXfTAvg3Xu3u1c4uKHNd7dU+cd5KYSRN2GTDQNQNBG5WwxtRKO4z2nCRZsu7OcYlFz1x6/mKxDq QJvCP5Leoc7pz7JIgc32Nk3b10wfYV7f0AFonbuxjXfcqhLfSggMHBEltS7lwINNgdRQeQM9K0Nll I/iMwi5nc0yoGLJEy73A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTFS-0003Dq-PM; Wed, 21 Nov 2018 14:12:58 +0000 Received: from mail-eopbgr00088.outbound.protection.outlook.com ([40.107.0.88] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTF9-0002nT-8S for linux-arm-kernel@lists.infradead.org; Wed, 21 Nov 2018 14:12:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=++Qxne8dQ1ktEsMswkJ0ZStjximCIC4hNxe4xy5zl3o=; b=W3PnYv7eFukSvFY8tFlVvhZiZD55cusw492cwBMiXOuAWZYuvASYQ3wGJEO7r8ZEaFdRSbE/txhi5b90+SacM+8f714cQXVBy3sE+V2elzyhJvknm7QnsH2sjOxNrb/jNKkApPsYB+EOV1yu/JlNiutdbxO3gADSD429ktCtcYA= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.126.21) by AM0PR04MB4081.eurprd04.prod.outlook.com (52.134.125.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.23; Wed, 21 Nov 2018 14:12:23 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927%2]) with mapi id 15.20.1339.027; Wed, 21 Nov 2018 14:12:23 +0000 From: Aisheng DONG To: "linux-clk@vger.kernel.org" Subject: [PATCH V8 2/7] clk: imx: add scu clock common part Thread-Topic: [PATCH V8 2/7] clk: imx: add scu clock common part Thread-Index: AQHUgaQ57574XhcTGkWdT/7YvWkhRg== Date: Wed, 21 Nov 2018 14:12:23 +0000 Message-ID: <1542809234-539-3-git-send-email-aisheng.dong@nxp.com> References: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0178.apcprd02.prod.outlook.com (2603:1096:201:21::14) To AM0PR04MB4211.eurprd04.prod.outlook.com (2603:10a6:208:66::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR04MB4081; 6:LSYAvySZOptkGkhgYuNuXaW2h7ZTNBp9FrzV6zHe6Pi9fH+Q/Y7A9DHUEv4xOceaU4+Dp/6OihbJDTNXKO1fP33nukMyvEGe0xSfWA5lzhRzpggPtkzLZ+6/HvfZX2yJ/slxw6GXch25j8gE9nl5ew+sYAJvsOOhHea1bnYPhW2gPVjYuR7u+OE/UkqP0Hdjua8ESyqnRGNPU/zhECvtLb3TUZdrQVq2aTW0zXdbWhovk8kf8DXKMMJPOY4xJ1oval4gWVsEwENlgWuMY3iFbtgcpNUl0bzt7A3ettnJ0Yv0Sal8zG9LdxH6lR8Atx53F39lwxMMuUMqNJ8jIP9/dNNbcAMz2q0FvKeLo3yVAENa981m0cJ7XX7Uk/sTNliBsOJRJNDtgaTG8zYShJ6hv2mQliiBv1asxfydoH/Yb2zjqPRb09B2s/14EqvIbRoS8BS6P0r9Y35uOXwKIc6yjQ==; 5:ZvhpIC9Dx3a2m2Qx17OzXAlAVPeKHxTcjAWJaCA4FAgQQbKPX/GtjamZbGROKTpUaI+vnjDewqoHm+tGMoANvVmjZMab1D8TSqX3mTAQ+i6QOyusqAB3IL3mSv6or0nlfYG/ytvBYYrqrhtNy23hO0OBXCZqYSTTXIUKITMZnd8=; 7:6VTSHdOyOYE79Lf5dqB/QPBNXFwii3fSSpY+4j8pFeGMxzS+5KaQL/hSUSZYMzPk7qVTHcPzGbl9tVmUHiZAPa++fpWtm1Ctx0wBp3w41CK70hr0F8rlAAv1ajmHBcPYT5YFaJQsfz6Je3Gf8HJt5g== x-ms-office365-filtering-correlation-id: 4c119814-bd03-4ef8-5054-08d64fbb5b34 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB4081; x-ms-traffictypediagnostic: AM0PR04MB4081: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231442)(944501410)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:AM0PR04MB4081; BCL:0; PCL:0; RULEID:; SRVR:AM0PR04MB4081; x-forefront-prvs: 08635C03D4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(346002)(396003)(376002)(39860400002)(366004)(199004)(189003)(54534003)(6506007)(386003)(54906003)(2900100001)(76176011)(105586002)(66066001)(50226002)(26005)(3846002)(102836004)(2501003)(186003)(6486002)(305945005)(7736002)(4326008)(8676002)(478600001)(68736007)(52116002)(106356001)(2351001)(5660300001)(316002)(14454004)(446003)(6916009)(5640700003)(81156014)(25786009)(2906002)(81166006)(2616005)(476003)(486006)(86362001)(6436002)(6116002)(97736004)(71190400001)(14444005)(11346002)(99286004)(53936002)(6512007)(256004)(8936002)(71200400001)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4081; H:AM0PR04MB4211.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ibHjIUGZVwiY8ZESXlbu7bMHm3fdoBkQ+gGobF75N8rSLlPn+2gV4s0/J1fu6YwI7tKhRPzQLBnBIxFtFqILMunJWz4RgEhnMVfDMDRyGx93TAzte2xH7jxyR45IdGtEeDkjyiRJIO8qqdu9kY7mUfseyoAFJc4x0ccUTfZv7DsvimuDbxpUHS0nbBQyHqLqTFCuHqALPK/FPWc5m3veZW6bTxdzME2PEfgTQhGD0tQO2V9JggLXsgKO2IvEaEyHMXf2VFm+bwA648ruFARsAn1BuZMwk0YoR/gB1vCSj4i8RGAJdMAr4SzTSUe/czd/Fry7QLveaFdvJ2JlzcCDkM8UQew8CAx0lG5x1rOidfY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c119814-bd03-4ef8-5054-08d64fbb5b34 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2018 14:12:23.6824 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4081 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181121_061239_474442_BDEF009D X-CRM114-Status: GOOD ( 23.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aisheng DONG , "sboyd@kernel.org" , "mturquette@baylibre.com" , dl-linux-imx , "kernel@pengutronix.de" , Fabio Estevam , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add scu clock common part which will be used by client clock drivers. SCU clocks are totally different from the legacy clocks (No much legacy things can be reused). So a new configuration option CONFIG_MXC_CLK_SCU is added. Cc: Shawn Guo Cc: Sascha Hauer Cc: Fabio Estevam Cc: Stephen Boyd Cc: Michael Turquette Signed-off-by: Dong Aisheng --- ChangeLog: v7->v8: * add kernel doc for scu protocol structures v7: * no changes v5->v6: * simply the whole clock driver a lot by re-orgnizing the driver into a few clock types:: scu clock (merge scu divider/gate/mux) and scu gpr lock which accessing is through SCU protocol and LPCG clock which is directly accessible by CPU. * LPCG clock support will be added in next patch, gpr clock is still not used and will be added later. * remove old year license as the code is totally rewritten * scu mux support will be added later as it's also still not used. v4->v5: * add more explanation in commit message on why put scu clocks in a deeper folder. * move scu clk files into the top directory of imx folder v3->v4: * scu headfile path change v2->v3: * no changes v1->v2: * update function call name --- drivers/clk/imx/Kconfig | 4 + drivers/clk/imx/Makefile | 3 + drivers/clk/imx/clk-scu.c | 267 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/clk/imx/clk-scu.h | 21 ++++ 4 files changed, 295 insertions(+) create mode 100644 drivers/clk/imx/clk-scu.c create mode 100644 drivers/clk/imx/clk-scu.h diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig index 43a3ecc..63e7b01 100644 --- a/drivers/clk/imx/Kconfig +++ b/drivers/clk/imx/Kconfig @@ -3,3 +3,7 @@ config MXC_CLK bool depends on ARCH_MXC + +config MXC_CLK_SCU + bool + depends on ARCH_MXC && ARM64 diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile index d447f8c..eec6d72 100644 --- a/drivers/clk/imx/Makefile +++ b/drivers/clk/imx/Makefile @@ -13,6 +13,9 @@ obj-$(CONFIG_MXC_CLK) += \ clk-pllv3.o \ clk-pfd.o +obj-$(CONFIG_MXC_CLK_SCU) += \ + clk-scu.o + obj-$(CONFIG_SOC_IMX1) += clk-imx1.o obj-$(CONFIG_SOC_IMX21) += clk-imx21.o obj-$(CONFIG_SOC_IMX25) += clk-imx25.o diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c new file mode 100644 index 0000000..5f9c1f6 --- /dev/null +++ b/drivers/clk/imx/clk-scu.c @@ -0,0 +1,267 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2018 NXP + * Dong Aisheng + */ + +#include +#include +#include + +#include "clk-scu.h" + +struct imx_sc_ipc *ccm_ipc_handle; + +/* + * struct clk_scu - Description of one SCU clock + * @hw: the common clk_hw + * @rsrc_id: resource ID of this SCU clock + * @clk_type: type of this clock resource + * + * This structure describes one SCU clock + */ +struct clk_scu { + struct clk_hw hw; + u32 rsrc_id; + u8 clk_type; +}; + +/* + * struct imx_sc_msg_req_set_clock_rate - clock set rate protocol + * @hdr: SCU protocol header + * @rate: rate to set + * @resource: clock resource to set rate + * @clk: clk type of this resource + * + * This structure describes the SCU protocol of clock rate set + */ +struct imx_sc_msg_req_set_clock_rate { + struct imx_sc_rpc_msg hdr; + u32 rate; + u16 resource; + u8 clk; +} __packed; + +struct req_get_clock_rate { + u16 resource; + u8 clk; +} __packed; + +struct resp_get_clock_rate { + u32 rate; +}; + +/* + * struct imx_sc_msg_get_clock_rate - clock get rate protocol + * @hdr: SCU protocol header + * @req: get rate request protocol + * @resp: get rate response protocol + * + * This structure describes the SCU protocol of clock rate get + */ +struct imx_sc_msg_get_clock_rate { + struct imx_sc_rpc_msg hdr; + union { + struct req_get_clock_rate req; + struct resp_get_clock_rate resp; + } data; +} __packed; + +/* + * struct imx_sc_msg_req_clock_enable - clock gate protocol + * @hdr: SCU protocol header + * @resource: clock resource to gate + * @clk: clk type of this resource + * @enable: whether gate off the clock + * @autog: HW auto gate enable + * + * This structure describes the SCU protocol of clock gate + */ +struct imx_sc_msg_req_clock_enable { + struct imx_sc_rpc_msg hdr; + u16 resource; + u8 clk; + u8 enable; + u8 autog; +} __packed; + +static inline struct clk_scu *to_clk_scu(struct clk_hw *hw) +{ + return container_of(hw, struct clk_scu, hw); +} + +/* + * clk_scu_recalc_rate - Get clock rate for a SCU clock + * @hw: clock to get rate for + * @parent_rate: parent rate provided by common clock framework, not used + * + * Gets the current clock rate of a SCU clock. Returns the current + * clock rate, or zero in failure. + */ +static unsigned long clk_scu_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct clk_scu *clk = to_clk_scu(hw); + struct imx_sc_msg_get_clock_rate msg; + struct imx_sc_rpc_msg *hdr = &msg.hdr; + int ret; + + hdr->ver = IMX_SC_RPC_VERSION; + hdr->svc = IMX_SC_RPC_SVC_PM; + hdr->func = IMX_SC_PM_FUNC_GET_CLOCK_RATE; + hdr->size = 2; + + msg.data.req.resource = clk->rsrc_id; + msg.data.req.clk = clk->clk_type; + + ret = imx_scu_call_rpc(ccm_ipc_handle, &msg, true); + if (ret) { + pr_err("%s: failed to get clock rate %d\n", + clk_hw_get_name(hw), ret); + return 0; + } + + return msg.data.resp.rate; +} + +/* + * clk_scu_round_rate - Round clock rate for a SCU clock + * @hw: clock to round rate for + * @rate: rate to round + * @parent_rate: parent rate provided by common clock framework, not used + * + * Returns the current clock rate, or zero in failure. + */ +static long clk_scu_round_rate(struct clk_hw *hw, unsigned long rate, + unsigned long *parent_rate) +{ + /* + * Assume we support all the requested rate and let the SCU firmware + * to handle the left work + */ + return rate; +} + +/* + * clk_scu_set_rate - Set rate for a SCU clock + * @hw: clock to change rate for + * @rate: target rate for the clock + * @parent_rate: rate of the clock parent, not used for SCU clocks + * + * Sets a clock frequency for a SCU clock. Returns the SCU + * protocol status. + */ +static int clk_scu_set_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) +{ + struct clk_scu *clk = to_clk_scu(hw); + struct imx_sc_msg_req_set_clock_rate msg; + struct imx_sc_rpc_msg *hdr = &msg.hdr; + + hdr->ver = IMX_SC_RPC_VERSION; + hdr->svc = IMX_SC_RPC_SVC_PM; + hdr->func = IMX_SC_PM_FUNC_SET_CLOCK_RATE; + hdr->size = 3; + + msg.rate = rate; + msg.resource = clk->rsrc_id; + msg.clk = clk->clk_type; + + return imx_scu_call_rpc(ccm_ipc_handle, &msg, true); +} + +static int sc_pm_clock_enable(struct imx_sc_ipc *ipc, u32 resource, + u8 clk, bool enable, bool autog) +{ + struct imx_sc_msg_req_clock_enable msg; + struct imx_sc_rpc_msg *hdr = &msg.hdr; + + hdr->ver = IMX_SC_RPC_VERSION; + hdr->svc = IMX_SC_RPC_SVC_PM; + hdr->func = IMX_SC_PM_FUNC_CLOCK_ENABLE; + hdr->size = 3; + + msg.resource = resource; + msg.clk = clk; + msg.enable = enable; + msg.autog = autog; + + return imx_scu_call_rpc(ccm_ipc_handle, &msg, true); +} + +/* + * clk_scu_prepare - Enable a SCU clock + * @hw: clock to enable + * + * Enable the clock at the DSC slice level + */ +static int clk_scu_prepare(struct clk_hw *hw) +{ + struct clk_scu *clk = to_clk_scu(hw); + + return sc_pm_clock_enable(ccm_ipc_handle, clk->rsrc_id, + clk->clk_type, true, false); +} + +/* + * clk_scu_unprepare - Disable a SCU clock + * @hw: clock to enable + * + * Disable the clock at the DSC slice level + */ +static void clk_scu_unprepare(struct clk_hw *hw) +{ + struct clk_scu *clk = to_clk_scu(hw); + int ret; + + ret = sc_pm_clock_enable(ccm_ipc_handle, clk->rsrc_id, + clk->clk_type, false, false); + if (ret) + pr_warn("%s: clk unprepare failed %d\n", clk_hw_get_name(hw), + ret); +} + +static const struct clk_ops clk_scu_ops = { + .recalc_rate = clk_scu_recalc_rate, + .round_rate = clk_scu_round_rate, + .set_rate = clk_scu_set_rate, + .prepare = clk_scu_prepare, + .unprepare = clk_scu_unprepare, +}; + +struct clk_hw *imx_clk_scu(const char *name, u32 rsrc_id, u8 clk_type) +{ + struct clk_init_data init; + struct clk_scu *clk; + struct clk_hw *hw; + int ret; + + clk = kzalloc(sizeof(*clk), GFP_KERNEL); + if (!clk) + return ERR_PTR(-ENOMEM); + + clk->rsrc_id = rsrc_id; + clk->clk_type = clk_type; + + init.name = name; + init.ops = &clk_scu_ops; + init.num_parents = 0; + /* + * Note on MX8, the clocks are tightly coupled with power domain + * that once the power domain is off, the clock status may be + * lost. So we make it NOCACHE to let user to retrieve the real + * clock status from HW instead of using the possible invalid + * cached rate. + */ + init.flags = CLK_GET_RATE_NOCACHE; + clk->hw.init = &init; + + hw = &clk->hw; + ret = clk_hw_register(NULL, hw); + if (ret) { + kfree(clk); + hw = ERR_PTR(ret); + } + + return hw; +} diff --git a/drivers/clk/imx/clk-scu.h b/drivers/clk/imx/clk-scu.h new file mode 100644 index 0000000..09f381b --- /dev/null +++ b/drivers/clk/imx/clk-scu.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2018 NXP + * Dong Aisheng + */ + +#ifndef __IMX_CLK_SCU_H +#define __IMX_CLK_SCU_H + +#include + +extern struct imx_sc_ipc *ccm_ipc_handle; + +static inline int imx_clk_scu_init(void) +{ + return imx_scu_get_handle(&ccm_ipc_handle); +} + +struct clk_hw *imx_clk_scu(const char *name, u32 rsrc_id, u8 clk_type); + +#endif From patchwork Wed Nov 21 14:12:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10692623 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 679575A4 for ; Wed, 21 Nov 2018 14:13:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54BE12BCA5 for ; Wed, 21 Nov 2018 14:13:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 485062BCF4; Wed, 21 Nov 2018 14:13:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B15582BCA5 for ; Wed, 21 Nov 2018 14:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PYb2/L/JHC6usuD1r5wH0iOGJPie23LvlvQahhtlr5s=; b=Lc+wemBG95bqX+ tWfa3bI9Bk8WHnbTUAC/Zoeg+wd+u1lHCknj//TMhysM8jD6IJVRv1H4RJk4aoTbZU4fsLmBZ+K2S PaYPquCtEfcpit3njsXSutCf2BCya44ztZDfVF+WT/PRlU80tnpazw/87mNGxTmIOr3FqhkqtIQk5 3I7j+CJ3NxKUKZIrjIymzldwcpJ0UKYVCVJuaWBDcjWfx79Bon1dIUv51fbDIAEoeJ2NavS/81pkq 3LheLYxtadRaqirLdp587Swoh3RZgW2nW0AbeiABsxc/9C+c7ylBAjZ95kyjjgwGprCkJTyLaR76+ pbdpqC7LTUG+8Q9cGp9w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTFe-0003U9-20; Wed, 21 Nov 2018 14:13:10 +0000 Received: from mail-am5eur03on061e.outbound.protection.outlook.com ([2a01:111:f400:fe08::61e] helo=EUR03-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTFC-0002no-Qp for linux-arm-kernel@lists.infradead.org; Wed, 21 Nov 2018 14:12:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sBDNTz+Tdhnoyt4CLo7bH1/TE9Vie0LcwwB+acRpA4U=; b=EMgzepVY4SUSo7KbTAZZICixPDGiY9sa9ytYkWMPymO80INVp3D8IJ5pbtULTD2uIOXNMjSKpDpQOzYLAignUExZmcLqTVHofxpeIrYsjFibarMrmmJJjbkGrXsz4zgftHAYJMRxcRbmN9hpSnbtbQXa1iKYJNjBppUO1ouoZNU= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.126.21) by AM0PR04MB4996.eurprd04.prod.outlook.com (20.177.40.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.23; Wed, 21 Nov 2018 14:12:27 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927%2]) with mapi id 15.20.1339.027; Wed, 21 Nov 2018 14:12:27 +0000 From: Aisheng DONG To: "linux-clk@vger.kernel.org" Subject: [PATCH V8 3/7] dt-bindings: clock: imx8qxp: add SCU clock IDs Thread-Topic: [PATCH V8 3/7] dt-bindings: clock: imx8qxp: add SCU clock IDs Thread-Index: AQHUgaQ7Nert7e3VsEagvMvbPgyaBA== Date: Wed, 21 Nov 2018 14:12:27 +0000 Message-ID: <1542809234-539-4-git-send-email-aisheng.dong@nxp.com> References: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0178.apcprd02.prod.outlook.com (2603:1096:201:21::14) To AM0PR04MB4211.eurprd04.prod.outlook.com (2603:10a6:208:66::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR04MB4996; 6:q+RUkzKONlgft5LIBaN5fovo5MDYnSzxM4w2G59jd8TN6eCHyI6vyrtTm1gWJ6Flx8So/qWnxSwpnzZwm+DEk5WpRk1CW8mqnHu1wzbi3yfo+BynWfIjk0F/B7jSS0foQXcq9Ac00tN4eAwDUedyKijtOLIXIasD/PCoTT38YVO4oIw9y5tqCvE7oRIOnP05agFlsvSEj16o8pQwhKw8XhsjMDxR9yh0sQt1sIwAoAagHl9KjFa4i3SioYTC82wX2NmJXLFfOtKZeNj5Yh3Jq101bjFqHqGTk/KQJITCQRXViHn8tVOrXbDziiCmol40kT3cMnNngSNrKC9D8PHvHyWqYMfsIimouLvkZI7F/AqR9M2Z/f9GV4AiiJ8gZRq4YqcSiVhLZY6uuKwS42QM9YFyOOZCIoJBodt9re4+UPykKrpE61qn8ml4+tarX2I2v0cOn14oZqV17iDdD5x0EA==; 5:CGElq5TQ+KEcA8l1jaMALJVaR4L94DhzpYaJk+7JIprxfYRny7GkY9Arz6thbk9IJEWV5mwQeG+mUYUy8VqLAX3B7UOLIlyy1dY8bz9mbeVhy2R+zMaJtHdhVaxSAfz5/VbPNF2QWhWIpHEAHOk8dGK9jea1wQcoKYai6SMfED4=; 7:/tO4jzQ7+qrOp0R8ysERFQSz/7U2+bSHxsiwz2HSGF/m8mg2wILAosO7QJ04mM0GJn0LE4ND9TatlKsWghjTDBa5bpE1oI4f83lOB3gIeN2+RvipxEEFxvTJSxknvkH5VbwsedS9ZIiukuzK2Xo44A== x-ms-office365-filtering-correlation-id: d3cfa083-22d7-4e14-4254-08d64fbb5dd2 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB4996; x-ms-traffictypediagnostic: AM0PR04MB4996: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231442)(944501410)(52105112)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR04MB4996; BCL:0; PCL:0; RULEID:; SRVR:AM0PR04MB4996; x-forefront-prvs: 08635C03D4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(346002)(376002)(366004)(39860400002)(396003)(199004)(189003)(6486002)(478600001)(2351001)(50226002)(6436002)(105586002)(14444005)(186003)(106356001)(256004)(14454004)(2906002)(25786009)(3846002)(6512007)(53936002)(6116002)(5640700003)(36756003)(6916009)(26005)(68736007)(2501003)(54906003)(99286004)(86362001)(71190400001)(71200400001)(81166006)(81156014)(316002)(446003)(11346002)(102836004)(8676002)(8936002)(76176011)(486006)(52116002)(476003)(386003)(2616005)(6506007)(66066001)(2900100001)(7736002)(305945005)(5660300001)(97736004)(4326008)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4996; H:AM0PR04MB4211.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ZN+R+MWYwoGCJoytfTQWR6oedn0B/XrAl6Fi+Oc5ew0nZRbiapEDtkusWEJ+rLllTK8V8OAhUXAg+OaO2KHFlmxpmiowd3c4qIdLYpGGwAWGVWvUsCRgZ+28IFsKVhdOMPzMgXBMzhYS0xqrfsmgBIcDpaK+93Yic98OCoex/7fVz3tUX7PaWEUyKjB9CTWGHHm24Vxm/EFPQhAPy8qf/RqUPH6k064tEcjYdlbNIPlPJNKaepmMMvcUecNIOybcJzYSurzgDCfcsPJDTCxW05ez8choQkmmZUVC+aKFkG+R0HTs8Fup3OyglquW7Free+p/bjZ7aWp12OyCOzFAuzphMQaTsSPtYCk/IBSC55g= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3cfa083-22d7-4e14-4254-08d64fbb5dd2 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2018 14:12:27.3543 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4996 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181121_061243_388616_ACFCF459 X-CRM114-Status: GOOD ( 13.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aisheng DONG , "devicetree@vger.kernel.org" , "sboyd@kernel.org" , "mturquette@baylibre.com" , dl-linux-imx , "kernel@pengutronix.de" , Fabio Estevam , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add IMX8QXP SCU clock IDs. Cc: Stephen Boyd Cc: Shawn Guo Cc: Sascha Hauer Cc: devicetree@vger.kernel.org Cc: linux-clk@vger.kernel.org Reviewed-by: Rob Herring Signed-off-by: Dong Aisheng --- v6->v8: * no changes v6: new patch, separate from driver changes to avoid a checkpatch warning IDs are changed a lot due to SCU divider/gate/mux are merged into one general SCU clock and LPCG clocks are moved out. --- include/dt-bindings/clock/imx8qxp-clock.h | 136 ++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 include/dt-bindings/clock/imx8qxp-clock.h diff --git a/include/dt-bindings/clock/imx8qxp-clock.h b/include/dt-bindings/clock/imx8qxp-clock.h new file mode 100644 index 0000000..d72a39c --- /dev/null +++ b/include/dt-bindings/clock/imx8qxp-clock.h @@ -0,0 +1,136 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2018 NXP + * Dong Aisheng + */ + +#ifndef __DT_BINDINGS_CLOCK_IMX8QXP_H +#define __DT_BINDINGS_CLOCK_IMX8QXP_H + +/* SCU Clocks */ + +#define IMX8QXP_CLK_DUMMY 0 + +/* CPU */ +#define IMX8QXP_A35_CLK 1 + +/* LSIO SS */ +#define IMX8QXP_LSIO_MEM_CLK 2 +#define IMX8QXP_LSIO_BUS_CLK 3 +#define IMX8QXP_LSIO_PWM0_CLK 10 +#define IMX8QXP_LSIO_PWM1_CLK 11 +#define IMX8QXP_LSIO_PWM2_CLK 12 +#define IMX8QXP_LSIO_PWM3_CLK 13 +#define IMX8QXP_LSIO_PWM4_CLK 14 +#define IMX8QXP_LSIO_PWM5_CLK 15 +#define IMX8QXP_LSIO_PWM6_CLK 16 +#define IMX8QXP_LSIO_PWM7_CLK 17 +#define IMX8QXP_LSIO_GPT0_CLK 18 +#define IMX8QXP_LSIO_GPT1_CLK 19 +#define IMX8QXP_LSIO_GPT2_CLK 20 +#define IMX8QXP_LSIO_GPT3_CLK 21 +#define IMX8QXP_LSIO_GPT4_CLK 22 +#define IMX8QXP_LSIO_FSPI0_CLK 23 +#define IMX8QXP_LSIO_FSPI1_CLK 24 + +/* Connectivity SS */ +#define IMX8QXP_CONN_AXI_CLK_ROOT 30 +#define IMX8QXP_CONN_AHB_CLK_ROOT 31 +#define IMX8QXP_CONN_IPG_CLK_ROOT 32 +#define IMX8QXP_CONN_SDHC0_CLK 40 +#define IMX8QXP_CONN_SDHC1_CLK 41 +#define IMX8QXP_CONN_SDHC2_CLK 42 +#define IMX8QXP_CONN_ENET0_ROOT_CLK 43 +#define IMX8QXP_CONN_ENET0_BYPASS_CLK 44 +#define IMX8QXP_CONN_ENET0_RGMII_CLK 45 +#define IMX8QXP_CONN_ENET1_ROOT_CLK 46 +#define IMX8QXP_CONN_ENET1_BYPASS_CLK 47 +#define IMX8QXP_CONN_ENET1_RGMII_CLK 48 +#define IMX8QXP_CONN_GPMI_BCH_IO_CLK 49 +#define IMX8QXP_CONN_GPMI_BCH_CLK 50 +#define IMX8QXP_CONN_USB2_ACLK 51 +#define IMX8QXP_CONN_USB2_BUS_CLK 52 +#define IMX8QXP_CONN_USB2_LPM_CLK 53 + +/* HSIO SS */ +#define IMX8QXP_HSIO_AXI_CLK 60 +#define IMX8QXP_HSIO_PER_CLK 61 + +/* Display controller SS */ +#define IMX8QXP_DC_AXI_EXT_CLK 70 +#define IMX8QXP_DC_AXI_INT_CLK 71 +#define IMX8QXP_DC_CFG_CLK 72 +#define IMX8QXP_DC0_PLL0_CLK 80 +#define IMX8QXP_DC0_PLL1_CLK 81 +#define IMX8QXP_DC0_DISP0_CLK 82 +#define IMX8QXP_DC0_DISP1_CLK 83 + +/* MIPI-LVDS SS */ +#define IMX8QXP_MIPI_IPG_CLK 90 +#define IMX8QXP_MIPI0_PIXEL_CLK 100 +#define IMX8QXP_MIPI0_BYPASS_CLK 101 +#define IMX8QXP_MIPI0_LVDS_PIXEL_CLK 102 +#define IMX8QXP_MIPI0_LVDS_BYPASS_CLK 103 +#define IMX8QXP_MIPI0_LVDS_PHY_CLK 104 +#define IMX8QXP_MIPI0_I2C0_CLK 105 +#define IMX8QXP_MIPI0_I2C1_CLK 106 +#define IMX8QXP_MIPI0_PWM0_CLK 107 +#define IMX8QXP_MIPI1_PIXEL_CLK 108 +#define IMX8QXP_MIPI1_BYPASS_CLK 109 +#define IMX8QXP_MIPI1_LVDS_PIXEL_CLK 110 +#define IMX8QXP_MIPI1_LVDS_BYPASS_CLK 111 +#define IMX8QXP_MIPI1_LVDS_PHY_CLK 112 +#define IMX8QXP_MIPI1_I2C0_CLK 113 +#define IMX8QXP_MIPI1_I2C1_CLK 114 +#define IMX8QXP_MIPI1_PWM0_CLK 115 + +/* IMG SS */ +#define IMX8QXP_IMG_AXI_CLK 120 +#define IMX8QXP_IMG_IPG_CLK 121 +#define IMX8QXP_IMG_PXL_CLK 122 + +/* MIPI-CSI SS */ +#define IMX8QXP_CSI0_CORE_CLK 130 +#define IMX8QXP_CSI0_ESC_CLK 131 +#define IMX8QXP_CSI0_PWM0_CLK 132 +#define IMX8QXP_CSI0_I2C0_CLK 133 + +/* PARALLER CSI SS */ +#define IMX8QXP_PARALLEL_CSI_DPLL_CLK 140 +#define IMX8QXP_PARALLEL_CSI_PIXEL_CLK 141 +#define IMX8QXP_PARALLEL_CSI_MCLK_CLK 142 + +/* VPU SS */ +#define IMX8QXP_VPU_ENC_CLK 150 +#define IMX8QXP_VPU_DEC_CLK 151 + +/* GPU SS */ +#define IMX8QXP_GPU0_CORE_CLK 160 +#define IMX8QXP_GPU0_SHADER_CLK 161 + +/* ADMA SS */ +#define IMX8QXP_ADMA_IPG_CLK_ROOT 165 +#define IMX8QXP_ADMA_UART0_CLK 170 +#define IMX8QXP_ADMA_UART1_CLK 171 +#define IMX8QXP_ADMA_UART2_CLK 172 +#define IMX8QXP_ADMA_UART3_CLK 173 +#define IMX8QXP_ADMA_SPI0_CLK 174 +#define IMX8QXP_ADMA_SPI1_CLK 175 +#define IMX8QXP_ADMA_SPI2_CLK 176 +#define IMX8QXP_ADMA_SPI3_CLK 177 +#define IMX8QXP_ADMA_CAN0_CLK 178 +#define IMX8QXP_ADMA_CAN1_CLK 179 +#define IMX8QXP_ADMA_CAN2_CLK 180 +#define IMX8QXP_ADMA_I2C0_CLK 181 +#define IMX8QXP_ADMA_I2C1_CLK 182 +#define IMX8QXP_ADMA_I2C2_CLK 183 +#define IMX8QXP_ADMA_I2C3_CLK 184 +#define IMX8QXP_ADMA_FTM0_CLK 185 +#define IMX8QXP_ADMA_FTM1_CLK 186 +#define IMX8QXP_ADMA_ADC0_CLK 187 +#define IMX8QXP_ADMA_PWM_CLK 188 +#define IMX8QXP_ADMA_LCD_CLK 189 + +#define IMX8QXP_SCU_CLK_END 190 + +#endif /* __DT_BINDINGS_CLOCK_IMX8QXP_H */ From patchwork Wed Nov 21 14:12:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10692625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F53C13BB for ; Wed, 21 Nov 2018 14:13:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D2A128536 for ; Wed, 21 Nov 2018 14:13:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 807592866C; Wed, 21 Nov 2018 14:13:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B65D12BCDF for ; Wed, 21 Nov 2018 14:13:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UG8wvJmrVoxv//onnvbTDH85kc++q3J5Zz9oi69EYGs=; b=WjSf1BE9X2T0OY fJSNmGRvV8y7dJOynsDVYAZGe5mKZAP1wfZShKSa9+ODuppYxOEBuMxYOcXGSY7+xOEPJ2aDAy02F EVX8ECfX/fxdNE+AjgZ4KaWz244lCPysTZTgEfGrIIRV2Vs8aBU3n+FQcCGmGmpDj/HeTiF8i4322 QqCB19MFdeem5eseBJkTTfxgpBFr3zlxsfFC5FtUnouN+YdYGY/X/zf/sasJt8x1gKW6Du35EIrT7 xB1EE8hjC660BSg/1C0ffiaaR/FEX7Lvv4R8TrRsyR0Y/kvHzgp5i55wLO+viCya69bZrNzJ3EgPr DLAZ+Eal8Ue0aeIcdbUQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTFp-0003jz-Aa; Wed, 21 Nov 2018 14:13:21 +0000 Received: from mail-eopbgr60075.outbound.protection.outlook.com ([40.107.6.75] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTFE-0002ns-28 for linux-arm-kernel@lists.infradead.org; Wed, 21 Nov 2018 14:12:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S1+qviX2rivOTdV4T5xN9QqjwL/tcbCf3uVC5FzNE4A=; b=lzNQQpZslitaCwTuBYsdPShw0vhg4o3jfge4IOhHStfyHnZWf/2sOLsfM85mxcPpNDdNqlco+hxOGmKCPOo3pctYG7erHLchGV512g5Lvpk4KJsVtWk1W06lldKTV0WuU1MgCEL+OEz04Fryct+GN6FvAPbYvHNuiEWDukc+Uvw= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.126.21) by AM0PR04MB5076.eurprd04.prod.outlook.com (20.177.40.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.23; Wed, 21 Nov 2018 14:12:30 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927%2]) with mapi id 15.20.1339.027; Wed, 21 Nov 2018 14:12:30 +0000 From: Aisheng DONG To: "linux-clk@vger.kernel.org" Subject: [PATCH V8 4/7] clk: imx: add imx8qxp clk driver Thread-Topic: [PATCH V8 4/7] clk: imx: add imx8qxp clk driver Thread-Index: AQHUgaQ9YyTszXMgqk2x/T2LZ+bBdw== Date: Wed, 21 Nov 2018 14:12:30 +0000 Message-ID: <1542809234-539-5-git-send-email-aisheng.dong@nxp.com> References: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0178.apcprd02.prod.outlook.com (2603:1096:201:21::14) To AM0PR04MB4211.eurprd04.prod.outlook.com (2603:10a6:208:66::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR04MB5076; 6:f+hbaNmun6jEZNEvGGSQ/nFgnMX0+LDunDAlTt4nexUOThJVBmtPWO2RvbPoNvmB7iTR0T01c55wNdTz+ktJcvFDpgFfwfS53mc6xpydD34l9ZnFvbLEq7BAgG4W6wU5AvaiRvsEhgnelvXmaxxHSekO/GYXpj56zL1mILUessu8HDBnETgYiBONLkJlAPHLKo/hXeZPhlzrx3+CDo8gsb6WSyzjCZACs3/3MdDjGxEKgTMzuNRXPnycNADimMV9/4CNurUlMmVe1Vog+6gplzNqEMmX0PKehPfLIEffIFC+1I3iifqTl8kmxhLm2G0vlG25jGkR8C9tPEYScVR61CS1gtX/ypjEYRvSyoWIttk0hgRIF1/cd9jxY3TXJATi+coM4r1XGJcPslUCbsFvsC3UDjiEmYpfX51OxcFtgYIRv/B7tivz9UzH7hbUGk/q7dleDfSlJ6OTh6A0AJk+Jw==; 5:4hhkgkDe9cmTw5NenYkESBaEO10ZFt8W8qwzWGv5hwDOL2nGJmFiDUkEwpTNCa8oGfm+u7r+UgTgoWuV8xCWv2tElNFpuBO2Wip8XMnfts1UL+0P65cKuWlWYqs4QAnd6wdH+SKt2Bx9QWrvgUYDLaz3Bs9hqes2cN70ifkVZ2o=; 7:vMF0aunAboQptsq28IA8HgBWUxLxYoZn5xcXPt/hzOTh2Zi23kD9PjkhIsbPQFml7SuKe3Bs3uTu4gy+L205Whi3yssBF0JpZveeXG7MAsKeTmilB4w6+WI5MhhX6Y1mTrrQTcigSqQRP641+H43Dw== x-ms-office365-filtering-correlation-id: 295925e5-7d99-4973-010e-08d64fbb5fda x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB5076; x-ms-traffictypediagnostic: AM0PR04MB5076: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231442)(944501410)(52105112)(93006095)(93001095)(10201501046)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:AM0PR04MB5076; BCL:0; PCL:0; RULEID:; SRVR:AM0PR04MB5076; x-forefront-prvs: 08635C03D4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(366004)(376002)(396003)(346002)(54534003)(199004)(189003)(76176011)(6916009)(52116002)(2906002)(6506007)(316002)(386003)(99286004)(8936002)(486006)(6486002)(186003)(26005)(11346002)(6436002)(2501003)(86362001)(2616005)(5660300001)(50226002)(102836004)(71190400001)(71200400001)(446003)(5640700003)(4326008)(476003)(106356001)(478600001)(305945005)(6116002)(3846002)(25786009)(105586002)(36756003)(14454004)(81166006)(2351001)(2900100001)(4744004)(54906003)(81156014)(7736002)(68736007)(97736004)(66066001)(8676002)(256004)(14444005)(53936002)(6512007)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB5076; H:AM0PR04MB4211.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: I0wMlN5gN6pz2iOCcKB+kR5/snW3RyYizSqbgz9K5jUxlOACuzyD2AdEohGhgoYqNzFyO/bwBWqofoYorE/3TItuBd5J6qvgInyS5/3Zd60sag1UIr4AxqcItMPqtWH2Gt64jMkJdqtkKIxG+Xr9huuVDpw1y+VM+8XXzsAdLmj2ktcYu1WaWYYdTfHl66wONTNHp76v19mcKiNOo4aQpFMZAiprf9EBNbO8NhMJ5Qqk3yKugl2bjbJbZ0+iHpQ36oa5mCvUtvN/VQD0eRe4MP82K9K2dvVzf+WKy6ws/FMBugqR2u/BO7ZOwQ4qSEyxEJD7TjzaOp+qjJ2nuF3GPYTESIaGDXQuGK8lm1oOG+I= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 295925e5-7d99-4973-010e-08d64fbb5fda X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2018 14:12:30.8073 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5076 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181121_061244_659696_99EF15A4 X-CRM114-Status: GOOD ( 17.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aisheng DONG , "sboyd@kernel.org" , "mturquette@baylibre.com" , dl-linux-imx , "kernel@pengutronix.de" , Fabio Estevam , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add imx8qxp clk driver which is based on SCU firmware clock service. Cc: Shawn Guo Cc: Sascha Hauer Cc: Fabio Estevam Cc: Stephen Boyd Cc: Michael Turquette Signed-off-by: Dong Aisheng --- ChangeLog: v7->v8: * move dt headfiles after normal linux headfiles according to Stephen's former suggestions v6->v7: * use struct_size() * remove MODULE_ macros * add suppress_bind_attrs v5->v6: * changed to new scu clock type imx_clk_scu clk number is reduced signifcantly * moved lpcgs clock out into separate driver v4->v5: Address all comments from Stephen * more unique name for clk_data * remove void __iomem * cast for LPCG physical address * move out external fixed clk definition * drop using of imx_clk_hw_fixed and imx_check_clk_hws wrappers * remove i'm alive message * move scu clk files into imx top directory v3->v4: * scu headfile path update v2->v3: * enum name update v1->v2: * no changes except headfile name updated --- drivers/clk/imx/Makefile | 2 + drivers/clk/imx/clk-imx8qxp.c | 153 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 drivers/clk/imx/clk-imx8qxp.c diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile index eec6d72..8369a34 100644 --- a/drivers/clk/imx/Makefile +++ b/drivers/clk/imx/Makefile @@ -30,3 +30,5 @@ obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o obj-$(CONFIG_SOC_IMX6UL) += clk-imx6ul.o obj-$(CONFIG_SOC_IMX7D) += clk-imx7d.o obj-$(CONFIG_SOC_VF610) += clk-vf610.o + +obj-$(CONFIG_SOC_IMX8QXP) += clk-imx8qxp.o diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c new file mode 100644 index 0000000..a957704 --- /dev/null +++ b/drivers/clk/imx/clk-imx8qxp.c @@ -0,0 +1,153 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2018 NXP + * Dong Aisheng + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "clk-scu.h" + +#include +#include + +static int imx8qxp_clk_probe(struct platform_device *pdev) +{ + struct device_node *ccm_node = pdev->dev.of_node; + struct clk_hw_onecell_data *clk_data; + struct clk_hw **clks; + int ret, i; + + ret = imx_clk_scu_init(); + if (ret) + return ret; + + clk_data = devm_kzalloc(&pdev->dev, struct_size(clk_data, hws, + IMX8QXP_SCU_CLK_END), GFP_KERNEL); + if (!clk_data) + return -ENOMEM; + + clk_data->num = IMX8QXP_SCU_CLK_END; + clks = clk_data->hws; + + /* Fixed clocks */ + clks[IMX8QXP_CLK_DUMMY] = clk_hw_register_fixed_rate(NULL, "dummy", NULL, 0, 0); + clks[IMX8QXP_ADMA_IPG_CLK_ROOT] = clk_hw_register_fixed_rate(NULL, "dma_ipg_clk_root", NULL, 0, 120000000); + clks[IMX8QXP_CONN_AXI_CLK_ROOT] = clk_hw_register_fixed_rate(NULL, "conn_axi_clk_root", NULL, 0, 333333333); + clks[IMX8QXP_CONN_AHB_CLK_ROOT] = clk_hw_register_fixed_rate(NULL, "conn_ahb_clk_root", NULL, 0, 166666666); + clks[IMX8QXP_CONN_IPG_CLK_ROOT] = clk_hw_register_fixed_rate(NULL, "conn_ipg_clk_root", NULL, 0, 83333333); + clks[IMX8QXP_DC_AXI_EXT_CLK] = clk_hw_register_fixed_rate(NULL, "dc_axi_ext_clk_root", NULL, 0, 800000000); + clks[IMX8QXP_DC_AXI_INT_CLK] = clk_hw_register_fixed_rate(NULL, "dc_axi_int_clk_root", NULL, 0, 400000000); + clks[IMX8QXP_DC_CFG_CLK] = clk_hw_register_fixed_rate(NULL, "dc_cfg_clk_root", NULL, 0, 100000000); + clks[IMX8QXP_MIPI_IPG_CLK] = clk_hw_register_fixed_rate(NULL, "mipi_ipg_clk_root", NULL, 0, 120000000); + clks[IMX8QXP_IMG_AXI_CLK] = clk_hw_register_fixed_rate(NULL, "img_axi_clk_root", NULL, 0, 400000000); + clks[IMX8QXP_IMG_IPG_CLK] = clk_hw_register_fixed_rate(NULL, "img_ipg_clk_root", NULL, 0, 200000000); + clks[IMX8QXP_IMG_PXL_CLK] = clk_hw_register_fixed_rate(NULL, "img_pxl_clk_root", NULL, 0, 600000000); + clks[IMX8QXP_HSIO_AXI_CLK] = clk_hw_register_fixed_rate(NULL, "hsio_axi_clk_root", NULL, 0, 400000000); + clks[IMX8QXP_HSIO_PER_CLK] = clk_hw_register_fixed_rate(NULL, "hsio_per_clk_root", NULL, 0, 133333333); + clks[IMX8QXP_LSIO_MEM_CLK] = clk_hw_register_fixed_rate(NULL, "lsio_mem_clk_root", NULL, 0, 100000000); + clks[IMX8QXP_LSIO_BUS_CLK] = clk_hw_register_fixed_rate(NULL, "lsio_bus_clk_root", NULL, 0, 200000000); + + /* ARM core */ + clks[IMX8QXP_A35_CLK] = imx_clk_scu("a35_clk", IMX_SC_R_A35, IMX_SC_PM_CLK_CPU); + + /* LSIO SS */ + clks[IMX8QXP_LSIO_PWM0_CLK] = imx_clk_scu("pwm0_clk", IMX_SC_R_PWM_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_PWM1_CLK] = imx_clk_scu("pwm1_clk", IMX_SC_R_PWM_1, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_PWM2_CLK] = imx_clk_scu("pwm2_clk", IMX_SC_R_PWM_2, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_PWM3_CLK] = imx_clk_scu("pwm3_clk", IMX_SC_R_PWM_3, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_PWM4_CLK] = imx_clk_scu("pwm4_clk", IMX_SC_R_PWM_4, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_PWM5_CLK] = imx_clk_scu("pwm5_clk", IMX_SC_R_PWM_5, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_PWM6_CLK] = imx_clk_scu("pwm6_clk", IMX_SC_R_PWM_6, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_PWM7_CLK] = imx_clk_scu("pwm7_clk", IMX_SC_R_PWM_7, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_GPT0_CLK] = imx_clk_scu("gpt0_clk", IMX_SC_R_GPT_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_GPT1_CLK] = imx_clk_scu("gpt1_clk", IMX_SC_R_GPT_1, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_GPT2_CLK] = imx_clk_scu("gpt2_clk", IMX_SC_R_GPT_2, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_GPT3_CLK] = imx_clk_scu("gpt3_clk", IMX_SC_R_GPT_3, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_GPT4_CLK] = imx_clk_scu("gpt4_clk", IMX_SC_R_GPT_4, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_FSPI0_CLK] = imx_clk_scu("fspi0_clk", IMX_SC_R_FSPI_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_LSIO_FSPI1_CLK] = imx_clk_scu("fspi1_clk", IMX_SC_R_FSPI_1, IMX_SC_PM_CLK_PER); + + /* ADMA SS */ + clks[IMX8QXP_ADMA_UART0_CLK] = imx_clk_scu("uart0_clk", IMX_SC_R_UART_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_UART1_CLK] = imx_clk_scu("uart1_clk", IMX_SC_R_UART_1, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_UART2_CLK] = imx_clk_scu("uart2_clk", IMX_SC_R_UART_2, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_UART3_CLK] = imx_clk_scu("uart3_clk", IMX_SC_R_UART_3, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_SPI0_CLK] = imx_clk_scu("spi0_clk", IMX_SC_R_SPI_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_SPI1_CLK] = imx_clk_scu("spi1_clk", IMX_SC_R_SPI_2, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_SPI2_CLK] = imx_clk_scu("spi2_clk", IMX_SC_R_SPI_2, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_SPI3_CLK] = imx_clk_scu("spi3_clk", IMX_SC_R_SPI_3, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_CAN0_CLK] = imx_clk_scu("can0_clk", IMX_SC_R_CAN_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_I2C0_CLK] = imx_clk_scu("i2c0_clk", IMX_SC_R_I2C_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_I2C1_CLK] = imx_clk_scu("i2c1_clk", IMX_SC_R_I2C_1, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_I2C2_CLK] = imx_clk_scu("i2c2_clk", IMX_SC_R_I2C_2, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_I2C3_CLK] = imx_clk_scu("i2c3_clk", IMX_SC_R_I2C_3, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_FTM0_CLK] = imx_clk_scu("ftm0_clk", IMX_SC_R_FTM_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_FTM1_CLK] = imx_clk_scu("ftm1_clk", IMX_SC_R_FTM_1, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_ADC0_CLK] = imx_clk_scu("adc0_clk", IMX_SC_R_ADC_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_PWM_CLK] = imx_clk_scu("pwm_clk", IMX_SC_R_LCD_0_PWM_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_ADMA_LCD_CLK] = imx_clk_scu("lcd_clk", IMX_SC_R_LCD_0, IMX_SC_PM_CLK_PER); + + /* Connectivity */ + clks[IMX8QXP_CONN_SDHC0_CLK] = imx_clk_scu("sdhc0_clk", IMX_SC_R_SDHC_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_CONN_SDHC1_CLK] = imx_clk_scu("sdhc1_clk", IMX_SC_R_SDHC_1, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_CONN_SDHC2_CLK] = imx_clk_scu("sdhc2_clk", IMX_SC_R_SDHC_2, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_CONN_ENET0_ROOT_CLK] = imx_clk_scu("enet0_clk", IMX_SC_R_ENET_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_CONN_ENET0_BYPASS_CLK] = imx_clk_scu("enet0_bypass_clk", IMX_SC_R_ENET_0, IMX_SC_PM_CLK_BYPASS); + clks[IMX8QXP_CONN_ENET0_RGMII_CLK] = imx_clk_scu("enet0_rgmii_clk", IMX_SC_R_ENET_0, IMX_SC_PM_CLK_MISC0); + clks[IMX8QXP_CONN_ENET1_ROOT_CLK] = imx_clk_scu("enet1_clk", IMX_SC_R_ENET_1, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_CONN_ENET1_BYPASS_CLK] = imx_clk_scu("enet1_bypass_clk", IMX_SC_R_ENET_1, IMX_SC_PM_CLK_BYPASS); + clks[IMX8QXP_CONN_ENET1_RGMII_CLK] = imx_clk_scu("enet1_rgmii_clk", IMX_SC_R_ENET_1, IMX_SC_PM_CLK_MISC0); + clks[IMX8QXP_CONN_GPMI_BCH_IO_CLK] = imx_clk_scu("gpmi_io_clk", IMX_SC_R_NAND, IMX_SC_PM_CLK_MST_BUS); + clks[IMX8QXP_CONN_GPMI_BCH_CLK] = imx_clk_scu("gpmi_bch_clk", IMX_SC_R_NAND, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_CONN_USB2_ACLK] = imx_clk_scu("usb3_aclk_div", IMX_SC_R_USB_2, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_CONN_USB2_BUS_CLK] = imx_clk_scu("usb3_bus_div", IMX_SC_R_USB_2, IMX_SC_PM_CLK_MST_BUS); + clks[IMX8QXP_CONN_USB2_LPM_CLK] = imx_clk_scu("usb3_lpm_div", IMX_SC_R_USB_2, IMX_SC_PM_CLK_MISC); + + /* Display controller SS */ + clks[IMX8QXP_DC0_DISP0_CLK] = imx_clk_scu("dc0_disp0_clk", IMX_SC_R_DC_0, IMX_SC_PM_CLK_MISC0); + clks[IMX8QXP_DC0_DISP1_CLK] = imx_clk_scu("dc0_disp1_clk", IMX_SC_R_DC_0, IMX_SC_PM_CLK_MISC1); + + /* MIPI-LVDS SS */ + clks[IMX8QXP_MIPI0_I2C0_CLK] = imx_clk_scu("mipi0_i2c0_clk", IMX_SC_R_MIPI_0_I2C_0, IMX_SC_PM_CLK_MISC2); + clks[IMX8QXP_MIPI0_I2C1_CLK] = imx_clk_scu("mipi0_i2c1_clk", IMX_SC_R_MIPI_0_I2C_1, IMX_SC_PM_CLK_MISC2); + + /* MIPI CSI SS */ + clks[IMX8QXP_CSI0_CORE_CLK] = imx_clk_scu("mipi_csi0_core_clk", IMX_SC_R_CSI_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_CSI0_ESC_CLK] = imx_clk_scu("mipi_csi0_esc_clk", IMX_SC_R_CSI_0, IMX_SC_PM_CLK_MISC); + clks[IMX8QXP_CSI0_I2C0_CLK] = imx_clk_scu("mipi_csi0_i2c0_clk", IMX_SC_R_CSI_0_I2C_0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_CSI0_PWM0_CLK] = imx_clk_scu("mipi_csi0_pwm0_clk", IMX_SC_R_CSI_0_PWM_0, IMX_SC_PM_CLK_PER); + + /* GPU SS */ + clks[IMX8QXP_GPU0_CORE_CLK] = imx_clk_scu("gpu_core0_clk", IMX_SC_R_GPU_0_PID0, IMX_SC_PM_CLK_PER); + clks[IMX8QXP_GPU0_SHADER_CLK] = imx_clk_scu("gpu_shader0_clk", IMX_SC_R_GPU_0_PID0, IMX_SC_PM_CLK_MISC); + + for (i = 0; i < clk_data->num; i++) { + if (IS_ERR(clks[i])) + pr_warn("i.MX clk %u: register failed with %ld\n", + i, PTR_ERR(clks[i])); + } + + return of_clk_add_hw_provider(ccm_node, of_clk_hw_onecell_get, clk_data); +} + +static const struct of_device_id imx8qxp_match[] = { + { .compatible = "fsl,imx8qxp-clk", }, + { /* sentinel */ } +}; + +static struct platform_driver imx8qxp_clk_driver = { + .driver = { + .name = "imx8qxp-clk", + .of_match_table = imx8qxp_match, + .suppress_bind_attrs = true, + }, + .probe = imx8qxp_clk_probe, +}; +builtin_platform_driver(imx8qxp_clk_driver); From patchwork Wed Nov 21 14:12:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10692627 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A8E05A4 for ; Wed, 21 Nov 2018 14:13:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5765F28536 for ; Wed, 21 Nov 2018 14:13:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AD4028785; Wed, 21 Nov 2018 14:13:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 882BB28536 for ; Wed, 21 Nov 2018 14:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3WG5n44YArVGmmRLGPdo3QaC6Ni8/9emnKnFoPj9OMs=; b=kOCGh/T3uwSQF4 lKASGdFKfBhGLsncwKAIDjyB6Xyirxby/gCknnGYY4VNlPAJWUMxp5rj6+X8fwXwlRI4syHtobs/R rb/fy3XFeuR8pL6NxNB5cV7OPmxlKIouILhc8/wR20XJ5DqdzXO8qL2bs8IrNSa7/CxOFDYUa/naG QNIDb+AKX8Uxtp6NclIzx7JqcT5e/Owt+R4Z1+I8pW+XDzOHljvVeo/IFsAdcgXvpPNWIxTn4pn5D 2iwgYX3nfVGBqOBIq4wv/mItU7YZyZ1JX1oLhILLFQvZnbkquOspHrskgxv5sKHqqy1Sj5agZysAu FbpOnH18OfNfo4M+8djw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTGN-0004AB-Ia; Wed, 21 Nov 2018 14:13:55 +0000 Received: from mail-eopbgr60075.outbound.protection.outlook.com ([40.107.6.75] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTFI-0002ns-6N for linux-arm-kernel@lists.infradead.org; Wed, 21 Nov 2018 14:12:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ezf+uFRXNPiP93qf/PcOozckKbSWdVq9sPlnfSloxF4=; b=EtPTFXAzVhjEgBWmczsFI+tBM8xPy9sVHFJyWBZqVEK8zPN84ujKinG/Typj7gqWodzuMFS+cDbIFwtgTq4r3YRNqvHCJpWsDGQ4P1hqRvcTWBfWTytu92I8NQLHX0aNglVgWM8mLwoM0a5hdEsP2g7kN+c0F/ML8edG1qAIjOQ= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.126.21) by AM0PR04MB5076.eurprd04.prod.outlook.com (20.177.40.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.23; Wed, 21 Nov 2018 14:12:35 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927%2]) with mapi id 15.20.1339.027; Wed, 21 Nov 2018 14:12:35 +0000 From: Aisheng DONG To: "linux-clk@vger.kernel.org" Subject: [PATCH V8 5/7] dt-bindings: clock: add imx8qxp lpcg clock binding Thread-Topic: [PATCH V8 5/7] dt-bindings: clock: add imx8qxp lpcg clock binding Thread-Index: AQHUgaQ/n7q5Ek9U60el+WoMRb27LQ== Date: Wed, 21 Nov 2018 14:12:34 +0000 Message-ID: <1542809234-539-6-git-send-email-aisheng.dong@nxp.com> References: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0178.apcprd02.prod.outlook.com (2603:1096:201:21::14) To AM0PR04MB4211.eurprd04.prod.outlook.com (2603:10a6:208:66::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR04MB5076; 6:b9Ng0Nd2oweIztZR02BD9aoTWSzBqKYPnnEjqLKW4xzLmjDxxtqppdhvXAvOfOfZNJFFUl4FKiwPFyfsAR6NqunKYJ8cqQLgHOdnmz3CohBmv7l6jElcKomrlKNVCH1ebShi2c3ZQzJNhgOATa0J6stpKo1g8UIGCSbnw4O5buCUtLJq41eqs+KsLcx5jJBvUqz34F9slnh3CRSN3fCGp95UD8uVOluPkNO3g5/hkP9sFx0Yxf6vBH8vVi4UG24EVS5mmwVaXXRS2i8bAIhEhyweqOOsFFdkSY3lqHohSzLBy1rAp0YneYX1QQbU7jz6iwKOpkx14+D9627V5eMRA7ajqcCf6NvPdnYdz1AXHzWNb5nnzE8qFsqPtWiyYCJUhc4XQgGcBTHWv6GZ8J9Q80BR43Sz4Syrkz9O/jBGfK3tJ+f/ST3LiF6SuZr0yj5nzqhMVTTbtkgxYKUX3iWYuA==; 5:5e1fDsZ+KyLm4F1mhosh/1cMhWdO+93Vh4POKIrTOS/TA4ufG74/npxKEhxNPHIatxwuNwaiEItiqXS1tJ5jdZNE4LyYfqqyc+GcMlf5f/R6+QW84h3nwfDo3hxYGAXe2WXmcxpbZRwir6e/24rQb3jMAzQgq5UgxMkTZBzwDlo=; 7:WC6DsHlh3k4jbYVBfXAh19I82H1M4rQta7TEwFLIwZjU+U6WYQvB4ojOcrG8zxhsi0qZfBSLQWgzA+fjsv13V06r/dsjCPRlIlzQwWFv1kmZtY88h1zdghbsIcXEQwPuz7+ES6jbAAA4y0WcLNhyhw== x-ms-office365-filtering-correlation-id: e555119a-86a1-44b2-9648-08d64fbb6218 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB5076; x-ms-traffictypediagnostic: AM0PR04MB5076: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231442)(944501410)(52105112)(93006095)(93001095)(10201501046)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:AM0PR04MB5076; BCL:0; PCL:0; RULEID:; SRVR:AM0PR04MB5076; x-forefront-prvs: 08635C03D4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(366004)(376002)(396003)(346002)(199004)(189003)(76176011)(6916009)(52116002)(2906002)(6506007)(316002)(386003)(99286004)(8936002)(486006)(6486002)(186003)(26005)(11346002)(6436002)(2501003)(86362001)(2616005)(5660300001)(50226002)(102836004)(71190400001)(71200400001)(446003)(5640700003)(4326008)(476003)(106356001)(478600001)(305945005)(6116002)(3846002)(25786009)(105586002)(36756003)(14454004)(81166006)(2351001)(2900100001)(54906003)(81156014)(7736002)(68736007)(97736004)(66066001)(8676002)(256004)(53936002)(6512007)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB5076; H:AM0PR04MB4211.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: PZf8ZEUc0JqMarXPEtrGuOiIiASVkaS5QwlYZVxr6HdlnfLo2jVm83G7WKVwQ10VStA8wAubsJr6yyy1JWOxQI1rvYOKR8k7MLVH/LsdgqI8t/lDJyLH1SY25CpFEg89BtkY4bh4u43Yn6946nK7yMk6VodDIg0/Cc17Xx56QiPbnoECRsolt9vtQZE2jCzrHbpvRG5xDKWPq1LRKZBAFaeiMxoCMqkXQiCmqwgOe3BF9ewZFJRavogUzMIMntRCUguzrIz/t9b5kZ5Do9JZ5roFHux7j8a1tl2iq8mvogsPZgSbvXsaKL/0cLHc8/G6tDTYZkGkfFJrpPHz8v3H7BLGRGqoy6anpROau/JGSWc= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e555119a-86a1-44b2-9648-08d64fbb6218 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2018 14:12:34.9792 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5076 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181121_061248_246922_DED93540 X-CRM114-Status: GOOD ( 15.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aisheng DONG , "devicetree@vger.kernel.org" , "sboyd@kernel.org" , "mturquette@baylibre.com" , dl-linux-imx , "kernel@pengutronix.de" , Fabio Estevam , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The Low-Power Clock Gate (LPCG) modules contain a local programming model to control the clock gates for the peripherals. An LPCG module is used to locally gate the clocks for the associated peripheral. Note: This level of clock gating is provided after the clocks are generated by the SCU resources and clock controls. Thus even if the clock is enabled by these control bits, it might still not be running based on the base resource. Cc: Stephen Boyd Cc: Shawn Guo Cc: Sascha Hauer Cc: devicetree@vger.kernel.org Reviewed-by: Rob Herring Signed-off-by: Dong Aisheng --- v6->v8: no changes --- .../devicetree/bindings/clock/imx8qxp-lpcg.txt | 51 +++++++ include/dt-bindings/clock/imx8qxp-clock.h | 153 +++++++++++++++++++++ 2 files changed, 204 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/imx8qxp-lpcg.txt diff --git a/Documentation/devicetree/bindings/clock/imx8qxp-lpcg.txt b/Documentation/devicetree/bindings/clock/imx8qxp-lpcg.txt new file mode 100644 index 0000000..965cfa4 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/imx8qxp-lpcg.txt @@ -0,0 +1,51 @@ +* NXP i.MX8QXP LPCG (Low-Power Clock Gating) Clock bindings + +The Low-Power Clock Gate (LPCG) modules contain a local programming +model to control the clock gates for the peripherals. An LPCG module +is used to locally gate the clocks for the associated peripheral. + +Note: +This level of clock gating is provided after the clocks are generated +by the SCU resources and clock controls. Thus even if the clock is +enabled by these control bits, it might still not be running based +on the base resource. + +Required properties: +- compatible: Should be one of: + "fsl,imx8qxp-lpcg-adma", + "fsl,imx8qxp-lpcg-conn", + "fsl,imx8qxp-lpcg-dc", + "fsl,imx8qxp-lpcg-dsp", + "fsl,imx8qxp-lpcg-gpu", + "fsl,imx8qxp-lpcg-hsio", + "fsl,imx8qxp-lpcg-img", + "fsl,imx8qxp-lpcg-lsio", + "fsl,imx8qxp-lpcg-vpu" +- reg: Address and length of the register set +- #clock-cells: Should be <1> + +The clock consumer should specify the desired clock by having the clock +ID in its "clocks" phandle cell. +See the full list of clock IDs from: +include/dt-bindings/clock/imx8qxp-clock.h + +Examples: + +#include + +conn_lpcg: clock-controller@5b200000 { + compatible = "fsl,imx8qxp-lpcg-conn"; + reg = <0x5b200000 0xb0000>; + #clock-cells = <1>; +}; + +usdhc1: mmc@5b010000 { + compatible = "fsl,imx8qxp-usdhc", "fsl,imx7d-usdhc"; + interrupt-parent = <&gic>; + interrupts = ; + reg = <0x5b010000 0x10000>; + clocks = <&conn_lpcg IMX8QXP_CONN_LPCG_SDHC0_IPG_CLK>, + <&conn_lpcg IMX8QXP_CONN_LPCG_SDHC0_PER_CLK>, + <&conn_lpcg IMX8QXP_CONN_LPCG_SDHC0_HCLK>; + clock-names = "ipg", "per", "ahb"; +}; diff --git a/include/dt-bindings/clock/imx8qxp-clock.h b/include/dt-bindings/clock/imx8qxp-clock.h index d72a39c..6fec368 100644 --- a/include/dt-bindings/clock/imx8qxp-clock.h +++ b/include/dt-bindings/clock/imx8qxp-clock.h @@ -133,4 +133,157 @@ #define IMX8QXP_SCU_CLK_END 190 +/* LPCG clocks */ + +/* LSIO SS LPCG */ +#define IMX8QXP_LSIO_LPCG_PWM0_IPG_CLK 0 +#define IMX8QXP_LSIO_LPCG_PWM0_IPG_S_CLK 1 +#define IMX8QXP_LSIO_LPCG_PWM0_IPG_HF_CLK 2 +#define IMX8QXP_LSIO_LPCG_PWM0_IPG_SLV_CLK 3 +#define IMX8QXP_LSIO_LPCG_PWM0_IPG_MSTR_CLK 4 +#define IMX8QXP_LSIO_LPCG_PWM1_IPG_CLK 5 +#define IMX8QXP_LSIO_LPCG_PWM1_IPG_S_CLK 6 +#define IMX8QXP_LSIO_LPCG_PWM1_IPG_HF_CLK 7 +#define IMX8QXP_LSIO_LPCG_PWM1_IPG_SLV_CLK 8 +#define IMX8QXP_LSIO_LPCG_PWM1_IPG_MSTR_CLK 9 +#define IMX8QXP_LSIO_LPCG_PWM2_IPG_CLK 10 +#define IMX8QXP_LSIO_LPCG_PWM2_IPG_S_CLK 11 +#define IMX8QXP_LSIO_LPCG_PWM2_IPG_HF_CLK 12 +#define IMX8QXP_LSIO_LPCG_PWM2_IPG_SLV_CLK 13 +#define IMX8QXP_LSIO_LPCG_PWM2_IPG_MSTR_CLK 14 +#define IMX8QXP_LSIO_LPCG_PWM3_IPG_CLK 15 +#define IMX8QXP_LSIO_LPCG_PWM3_IPG_S_CLK 16 +#define IMX8QXP_LSIO_LPCG_PWM3_IPG_HF_CLK 17 +#define IMX8QXP_LSIO_LPCG_PWM3_IPG_SLV_CLK 18 +#define IMX8QXP_LSIO_LPCG_PWM3_IPG_MSTR_CLK 19 +#define IMX8QXP_LSIO_LPCG_PWM4_IPG_CLK 20 +#define IMX8QXP_LSIO_LPCG_PWM4_IPG_S_CLK 21 +#define IMX8QXP_LSIO_LPCG_PWM4_IPG_HF_CLK 22 +#define IMX8QXP_LSIO_LPCG_PWM4_IPG_SLV_CLK 23 +#define IMX8QXP_LSIO_LPCG_PWM4_IPG_MSTR_CLK 24 +#define IMX8QXP_LSIO_LPCG_PWM5_IPG_CLK 25 +#define IMX8QXP_LSIO_LPCG_PWM5_IPG_S_CLK 26 +#define IMX8QXP_LSIO_LPCG_PWM5_IPG_HF_CLK 27 +#define IMX8QXP_LSIO_LPCG_PWM5_IPG_SLV_CLK 28 +#define IMX8QXP_LSIO_LPCG_PWM5_IPG_MSTR_CLK 29 +#define IMX8QXP_LSIO_LPCG_PWM6_IPG_CLK 30 +#define IMX8QXP_LSIO_LPCG_PWM6_IPG_S_CLK 31 +#define IMX8QXP_LSIO_LPCG_PWM6_IPG_HF_CLK 32 +#define IMX8QXP_LSIO_LPCG_PWM6_IPG_SLV_CLK 33 +#define IMX8QXP_LSIO_LPCG_PWM6_IPG_MSTR_CLK 34 +#define IMX8QXP_LSIO_LPCG_PWM7_IPG_CLK 35 +#define IMX8QXP_LSIO_LPCG_PWM7_IPG_S_CLK 36 +#define IMX8QXP_LSIO_LPCG_PWM7_IPG_HF_CLK 37 +#define IMX8QXP_LSIO_LPCG_PWM7_IPG_SLV_CLK 38 +#define IMX8QXP_LSIO_LPCG_PWM7_IPG_MSTR_CLK 39 +#define IMX8QXP_LSIO_LPCG_GPT0_IPG_CLK 40 +#define IMX8QXP_LSIO_LPCG_GPT0_IPG_S_CLK 41 +#define IMX8QXP_LSIO_LPCG_GPT0_IPG_HF_CLK 42 +#define IMX8QXP_LSIO_LPCG_GPT0_IPG_SLV_CLK 43 +#define IMX8QXP_LSIO_LPCG_GPT0_IPG_MSTR_CLK 44 +#define IMX8QXP_LSIO_LPCG_GPT1_IPG_CLK 45 +#define IMX8QXP_LSIO_LPCG_GPT1_IPG_S_CLK 46 +#define IMX8QXP_LSIO_LPCG_GPT1_IPG_HF_CLK 47 +#define IMX8QXP_LSIO_LPCG_GPT1_IPG_SLV_CLK 48 +#define IMX8QXP_LSIO_LPCG_GPT1_IPG_MSTR_CLK 49 +#define IMX8QXP_LSIO_LPCG_GPT2_IPG_CLK 50 +#define IMX8QXP_LSIO_LPCG_GPT2_IPG_S_CLK 51 +#define IMX8QXP_LSIO_LPCG_GPT2_IPG_HF_CLK 52 +#define IMX8QXP_LSIO_LPCG_GPT2_IPG_SLV_CLK 53 +#define IMX8QXP_LSIO_LPCG_GPT2_IPG_MSTR_CLK 54 +#define IMX8QXP_LSIO_LPCG_GPT3_IPG_CLK 55 +#define IMX8QXP_LSIO_LPCG_GPT3_IPG_S_CLK 56 +#define IMX8QXP_LSIO_LPCG_GPT3_IPG_HF_CLK 57 +#define IMX8QXP_LSIO_LPCG_GPT3_IPG_SLV_CLK 58 +#define IMX8QXP_LSIO_LPCG_GPT3_IPG_MSTR_CLK 59 +#define IMX8QXP_LSIO_LPCG_GPT4_IPG_CLK 60 +#define IMX8QXP_LSIO_LPCG_GPT4_IPG_S_CLK 61 +#define IMX8QXP_LSIO_LPCG_GPT4_IPG_HF_CLK 62 +#define IMX8QXP_LSIO_LPCG_GPT4_IPG_SLV_CLK 63 +#define IMX8QXP_LSIO_LPCG_GPT4_IPG_MSTR_CLK 64 +#define IMX8QXP_LSIO_LPCG_FSPI0_HCLK 65 +#define IMX8QXP_LSIO_LPCG_FSPI0_IPG_CLK 66 +#define IMX8QXP_LSIO_LPCG_FSPI0_IPG_S_CLK 67 +#define IMX8QXP_LSIO_LPCG_FSPI0_IPG_SFCK 68 +#define IMX8QXP_LSIO_LPCG_FSPI1_HCLK 69 +#define IMX8QXP_LSIO_LPCG_FSPI1_IPG_CLK 70 +#define IMX8QXP_LSIO_LPCG_FSPI1_IPG_S_CLK 71 +#define IMX8QXP_LSIO_LPCG_FSPI1_IPG_SFCK 72 + +#define IMX8QXP_LSIO_LPCG_CLK_END 73 + +/* Connectivity SS LPCG */ +#define IMX8QXP_CONN_LPCG_SDHC0_IPG_CLK 0 +#define IMX8QXP_CONN_LPCG_SDHC0_PER_CLK 1 +#define IMX8QXP_CONN_LPCG_SDHC0_HCLK 2 +#define IMX8QXP_CONN_LPCG_SDHC1_IPG_CLK 3 +#define IMX8QXP_CONN_LPCG_SDHC1_PER_CLK 4 +#define IMX8QXP_CONN_LPCG_SDHC1_HCLK 5 +#define IMX8QXP_CONN_LPCG_SDHC2_IPG_CLK 6 +#define IMX8QXP_CONN_LPCG_SDHC2_PER_CLK 7 +#define IMX8QXP_CONN_LPCG_SDHC2_HCLK 8 +#define IMX8QXP_CONN_LPCG_GPMI_APB_CLK 9 +#define IMX8QXP_CONN_LPCG_GPMI_BCH_APB_CLK 10 +#define IMX8QXP_CONN_LPCG_GPMI_BCH_IO_CLK 11 +#define IMX8QXP_CONN_LPCG_GPMI_BCH_CLK 12 +#define IMX8QXP_CONN_LPCG_APBHDMA_CLK 13 +#define IMX8QXP_CONN_LPCG_ENET0_ROOT_CLK 14 +#define IMX8QXP_CONN_LPCG_ENET0_TX_CLK 15 +#define IMX8QXP_CONN_LPCG_ENET0_AHB_CLK 16 +#define IMX8QXP_CONN_LPCG_ENET0_IPG_S_CLK 17 +#define IMX8QXP_CONN_LPCG_ENET0_IPG_CLK 18 + +#define IMX8QXP_CONN_LPCG_ENET1_ROOT_CLK 19 +#define IMX8QXP_CONN_LPCG_ENET1_TX_CLK 20 +#define IMX8QXP_CONN_LPCG_ENET1_AHB_CLK 21 +#define IMX8QXP_CONN_LPCG_ENET1_IPG_S_CLK 22 +#define IMX8QXP_CONN_LPCG_ENET1_IPG_CLK 23 + +#define IMX8QXP_CONN_LPCG_CLK_END 24 + +/* ADMA SS LPCG */ +#define IMX8QXP_ADMA_LPCG_UART0_IPG_CLK 0 +#define IMX8QXP_ADMA_LPCG_UART0_BAUD_CLK 1 +#define IMX8QXP_ADMA_LPCG_UART1_IPG_CLK 2 +#define IMX8QXP_ADMA_LPCG_UART1_BAUD_CLK 3 +#define IMX8QXP_ADMA_LPCG_UART2_IPG_CLK 4 +#define IMX8QXP_ADMA_LPCG_UART2_BAUD_CLK 5 +#define IMX8QXP_ADMA_LPCG_UART3_IPG_CLK 6 +#define IMX8QXP_ADMA_LPCG_UART3_BAUD_CLK 7 +#define IMX8QXP_ADMA_LPCG_SPI0_IPG_CLK 8 +#define IMX8QXP_ADMA_LPCG_SPI1_IPG_CLK 9 +#define IMX8QXP_ADMA_LPCG_SPI2_IPG_CLK 10 +#define IMX8QXP_ADMA_LPCG_SPI3_IPG_CLK 11 +#define IMX8QXP_ADMA_LPCG_SPI0_CLK 12 +#define IMX8QXP_ADMA_LPCG_SPI1_CLK 13 +#define IMX8QXP_ADMA_LPCG_SPI2_CLK 14 +#define IMX8QXP_ADMA_LPCG_SPI3_CLK 15 +#define IMX8QXP_ADMA_LPCG_CAN0_IPG_CLK 16 +#define IMX8QXP_ADMA_LPCG_CAN0_IPG_PE_CLK 17 +#define IMX8QXP_ADMA_LPCG_CAN0_IPG_CHI_CLK 18 +#define IMX8QXP_ADMA_LPCG_CAN1_IPG_CLK 19 +#define IMX8QXP_ADMA_LPCG_CAN1_IPG_PE_CLK 20 +#define IMX8QXP_ADMA_LPCG_CAN1_IPG_CHI_CLK 21 +#define IMX8QXP_ADMA_LPCG_CAN2_IPG_CLK 22 +#define IMX8QXP_ADMA_LPCG_CAN2_IPG_PE_CLK 23 +#define IMX8QXP_ADMA_LPCG_CAN2_IPG_CHI_CLK 24 +#define IMX8QXP_ADMA_LPCG_I2C0_CLK 25 +#define IMX8QXP_ADMA_LPCG_I2C1_CLK 26 +#define IMX8QXP_ADMA_LPCG_I2C2_CLK 27 +#define IMX8QXP_ADMA_LPCG_I2C3_CLK 28 +#define IMX8QXP_ADMA_LPCG_I2C0_IPG_CLK 29 +#define IMX8QXP_ADMA_LPCG_I2C1_IPG_CLK 30 +#define IMX8QXP_ADMA_LPCG_I2C2_IPG_CLK 31 +#define IMX8QXP_ADMA_LPCG_I2C3_IPG_CLK 32 +#define IMX8QXP_ADMA_LPCG_FTM0_CLK 33 +#define IMX8QXP_ADMA_LPCG_FTM1_CLK 34 +#define IMX8QXP_ADMA_LPCG_FTM0_IPG_CLK 35 +#define IMX8QXP_ADMA_LPCG_FTM1_IPG_CLK 36 +#define IMX8QXP_ADMA_LPCG_PWM_HI_CLK 37 +#define IMX8QXP_ADMA_LPCG_PWM_IPG_CLK 38 +#define IMX8QXP_ADMA_LPCG_LCD_PIX_CLK 39 +#define IMX8QXP_ADMA_LPCG_LCD_APB_CLK 40 + +#define IMX8QXP_ADMA_LPCG_CLK_END 41 + #endif /* __DT_BINDINGS_CLOCK_IMX8QXP_H */ From patchwork Wed Nov 21 14:12:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10692629 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0FC25A4 for ; Wed, 21 Nov 2018 14:14:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB74C2BA84 for ; Wed, 21 Nov 2018 14:14:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C6A52BAAC; Wed, 21 Nov 2018 14:14:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 342A72BA84 for ; Wed, 21 Nov 2018 14:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rf0hEX9n9ZQUuURFR6FhwfhyfqoBwhyZ4Oqer88iyIA=; b=RCs7N5+ImVaq8J fxup3i91tN5D9t2NyrJSGdSjlWRyoAl4uxLrPBSKOoytzIGwIx8TwYznolqNgRQHrqgjL0EzCK7lO FYBq8Jhxb6KrJWdP1BTQcirDkijyRUPfzLrHiyUXpklGaL4L7uoxf8Yrozv5V05yK5YnXkCZs+P4P RyokF6XUAL61ADK7Ms4uGzJm1GqdL3wRmLwDJvPF80DzwNoaHDIOmu20ajUllUZYug0FuecNvyKbn BPS+F8k/CzBqaVcn8HNEYwzdhkib5mRhXhxBd2bSbGxotQnnPbBAz6WuXWAjSjvOwe+woRk7PK1PV hTH+QSdKtEZQoDOmTiNw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTGW-0004JW-BB; Wed, 21 Nov 2018 14:14:04 +0000 Received: from mail-eopbgr60075.outbound.protection.outlook.com ([40.107.6.75] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTFM-0002ns-5N for linux-arm-kernel@lists.infradead.org; Wed, 21 Nov 2018 14:12:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LWnkiCS4NY31t4GjVc98V2E6AXLoFLKzSPDji0bBY7M=; b=TOg7Sy9IXytUvHxc/7nQ2ETUa8AUH/5Z8IRRxIeCTWqy/MxVxBKL5lliUfZl158cwN+87Huc6H37KzYP0lZaxALzNgYeZMdltSk5D2IGuS3GxaWZ2V3vGpCNDF9Lj2CZQUfqnbqjA4hfK4jEPJKA2DZW27nkdjK9O5YRKvJfH2I= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.126.21) by AM0PR04MB5076.eurprd04.prod.outlook.com (20.177.40.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.23; Wed, 21 Nov 2018 14:12:38 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927%2]) with mapi id 15.20.1339.027; Wed, 21 Nov 2018 14:12:38 +0000 From: Aisheng DONG To: "linux-clk@vger.kernel.org" Subject: [PATCH V8 6/7] clk: imx: add lpcg clock support Thread-Topic: [PATCH V8 6/7] clk: imx: add lpcg clock support Thread-Index: AQHUgaRCQQJmVj/lpEGe6LAmNSfItg== Date: Wed, 21 Nov 2018 14:12:38 +0000 Message-ID: <1542809234-539-7-git-send-email-aisheng.dong@nxp.com> References: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0178.apcprd02.prod.outlook.com (2603:1096:201:21::14) To AM0PR04MB4211.eurprd04.prod.outlook.com (2603:10a6:208:66::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR04MB5076; 6:jd9EcLuXZw34vGnReVtQ2K3qN1+znqSoFCGEKqE12+EfKuf5fz4odvc9uDuS/sU9tyHvDRQVum1evGrr+fmXTTZAwNLBTOjKvO/iVItrUYYF43ax4qDvqGBWbVYZOvS8lrbuiRWU7OrnCbYf2wi5M6LQz/qq2kE549NGD/B6EoBA+9C6vjWcKCYlFopJV8Lm3+yvE0VkBJ/Zu24Ua9WBRJLY8gQ/X8Ex1z/2C9ZlLSCD6ynVTFthiPzFTW+rcYEAOlD85PD3sowI3bm/mV4L1hjJSrUyQX3A74M63SuX4NcMlouAph1EMK823tJ6ILsLVKef9yrGcfJahO70gj7Jk1LiTp3dEbeI+CG9d+SWrORadKFh/CgV19e+ft7ALBXrAG1z3hAUTRYd2WY+T4Bo5G0vQUDDoVsx8aNI0BFWA3IRzHTf6050Q/hAM6OhciuIVlfQRp49aIIkuouqx2Z9/w==; 5:tASVOkbIpp+Ja74P4nv7HBym8osta4DfBX+Mj+i+PRnlCSLuDbFTMQN2t8cSJwJu/aPCe1MOaln6ktYREUfEVkHGj6FQ2XUNJqJNmYRP3kGuC0QdEmDr103PqxWxmpN/en9k6ITJXmdD4kQePDjmit+zYGm2bB0acExz69WZeHg=; 7:1RkFYSGjXsurC3aYHwRNqrq2+EC07kwYbRKVqj7E2fl2BJsl4ki64uiPnRxsEon4FDpFZvetnB+rVADFRBr+fg+r7scUxD4e03gluWJSk9n4w3cjlWPPK6fxmCOxw62KF8duS1HSyTr0jdZi7txFGA== x-ms-office365-filtering-correlation-id: 28e207b8-4da3-43c8-7990-08d64fbb6465 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB5076; x-ms-traffictypediagnostic: AM0PR04MB5076: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231442)(944501410)(52105112)(93006095)(93001095)(10201501046)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:AM0PR04MB5076; BCL:0; PCL:0; RULEID:; SRVR:AM0PR04MB5076; x-forefront-prvs: 08635C03D4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(366004)(376002)(396003)(346002)(54534003)(199004)(189003)(76176011)(6916009)(52116002)(2906002)(6506007)(316002)(386003)(99286004)(8936002)(486006)(6486002)(186003)(26005)(11346002)(575784001)(6436002)(2501003)(86362001)(2616005)(5660300001)(50226002)(102836004)(71190400001)(71200400001)(446003)(5640700003)(4326008)(476003)(106356001)(478600001)(305945005)(6116002)(3846002)(25786009)(105586002)(36756003)(14454004)(81166006)(2351001)(2900100001)(54906003)(81156014)(7736002)(68736007)(97736004)(66066001)(8676002)(256004)(14444005)(53936002)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB5076; H:AM0PR04MB4211.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: wuEqv142Vn/3vqxu5urjcklQErBkv2tdTzpkowGFYlmxOnwTbdA80s2S67YFI7cqFTjsC96zp1m6u0bJNeTvrwsjIsEtH9T3XHCeepKiXrsycI1hgNMGhMa8bxAoW+g3mx8FPvjU8tbQSCiAMp45SylxlpguxVNHS3ybrQrMpEzfvvdPyv/E1oYBHlGapehd25HALhCczdjYI5rueE+B27x9hH+b6JwyQTynN4SHbsZ65YVbx4IGP73tHYbJTAZuh0hEjMCeaExkyUQ/QMc720lKsY1VZIltwsbVpG9AEWalIFw1J4L9zJ/levwlaZHg+IfRQBGWS5FPq3mZOKBL5sOAnRaElhy0AtFP7bFBRUc= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28e207b8-4da3-43c8-7990-08d64fbb6465 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2018 14:12:38.4791 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5076 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181121_061252_840986_FAFDF6A6 X-CRM114-Status: GOOD ( 18.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aisheng DONG , "sboyd@kernel.org" , "mturquette@baylibre.com" , dl-linux-imx , "kernel@pengutronix.de" , Fabio Estevam , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The Low-Power Clock Gate (LPCG) modules contain a local programming model to control the clock gates for the peripherals. An LPCG module is used to locally gate the clocks for the associated peripheral. And they're bedind the SCU clock. Cc: Stephen Boyd Cc: Shawn Guo Cc: Sascha Hauer Cc: Fabio Estevam Cc: Michael Turquette Signed-off-by: Dong Aisheng --- ChangeLog: v7->v8: * add doc for struct clk_lpcg_scu * remove unneccessary reg checking v6: separate from [PATCH V5 5/9] clk: imx: scu: add scu clock gate --- drivers/clk/imx/Makefile | 3 +- drivers/clk/imx/clk-lpcg-scu.c | 113 +++++++++++++++++++++++++++++++++++++++++ drivers/clk/imx/clk-scu.h | 3 ++ 3 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/imx/clk-lpcg-scu.c diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile index 8369a34..cd2b6f0 100644 --- a/drivers/clk/imx/Makefile +++ b/drivers/clk/imx/Makefile @@ -14,7 +14,8 @@ obj-$(CONFIG_MXC_CLK) += \ clk-pfd.o obj-$(CONFIG_MXC_CLK_SCU) += \ - clk-scu.o + clk-scu.o \ + clk-lpcg-scu.o obj-$(CONFIG_SOC_IMX1) += clk-imx1.o obj-$(CONFIG_SOC_IMX21) += clk-imx21.o diff --git a/drivers/clk/imx/clk-lpcg-scu.c b/drivers/clk/imx/clk-lpcg-scu.c new file mode 100644 index 0000000..15b7d94 --- /dev/null +++ b/drivers/clk/imx/clk-lpcg-scu.c @@ -0,0 +1,113 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2018 NXP + * Dong Aisheng + */ + +#include +#include +#include +#include +#include + +static DEFINE_SPINLOCK(imx_lpcg_scu_lock); + +#define CLK_GATE_SCU_LPCG_MASK 0x3 +#define CLK_GATE_SCU_LPCG_HW_SEL BIT(0) +#define CLK_GATE_SCU_LPCG_SW_SEL BIT(1) + +/* + * struct clk_lpcg_scu - Description of LPCG clock + * + * @hw: clk_hw of this LPCG + * @reg: register of this LPCG clock + * @bit_idx: bit index of this LPCG clock + * @hw_gate: HW auto gate enable + * + * This structure describes one LPCG clock + */ +struct clk_lpcg_scu { + struct clk_hw hw; + void __iomem *reg; + u8 bit_idx; + bool hw_gate; +}; + +#define to_clk_lpcg_scu(_hw) container_of(_hw, struct clk_lpcg_scu, hw) + +static int clk_lpcg_scu_enable(struct clk_hw *hw) +{ + struct clk_lpcg_scu *clk = to_clk_lpcg_scu(hw); + unsigned long flags; + u32 reg; + + spin_lock_irqsave(&imx_lpcg_scu_lock, flags); + + reg = readl(clk->reg); + reg &= ~(CLK_GATE_SCU_LPCG_MASK << clk->bit_idx); + if (clk->hw_gate) + reg |= (CLK_GATE_SCU_LPCG_HW_SEL | + CLK_GATE_SCU_LPCG_SW_SEL) << clk->bit_idx; + else + reg |= (CLK_GATE_SCU_LPCG_SW_SEL << clk->bit_idx); + writel(reg, clk->reg); + + spin_unlock_irqrestore(&imx_lpcg_scu_lock, flags); + + return 0; +} + +static void clk_lpcg_scu_disable(struct clk_hw *hw) +{ + struct clk_lpcg_scu *clk = to_clk_lpcg_scu(hw); + unsigned long flags; + u32 reg; + + spin_lock_irqsave(&imx_lpcg_scu_lock, flags); + + reg = readl(clk->reg); + reg &= ~(CLK_GATE_SCU_LPCG_MASK << clk->bit_idx); + writel(reg, clk->reg); + + spin_unlock_irqrestore(&imx_lpcg_scu_lock, flags); +} + +static const struct clk_ops clk_lpcg_scu_ops = { + .enable = clk_lpcg_scu_enable, + .disable = clk_lpcg_scu_disable, +}; + +struct clk_hw *imx_clk_lpcg_scu(const char *name, const char *parent_name, + unsigned long flags, void __iomem *reg, + u8 bit_idx, bool hw_gate) +{ + struct clk_lpcg_scu *clk; + struct clk_init_data init; + struct clk_hw *hw; + int ret; + + clk = kzalloc(sizeof(*clk), GFP_KERNEL); + if (!clk) + return ERR_PTR(-ENOMEM); + + clk->reg = reg; + clk->bit_idx = bit_idx; + clk->hw_gate = hw_gate; + + init.name = name; + init.ops = &clk_lpcg_scu_ops; + init.flags = CLK_SET_RATE_PARENT | flags; + init.parent_names = parent_name ? &parent_name : NULL; + init.num_parents = parent_name ? 1 : 0; + + clk->hw.init = &init; + + hw = &clk->hw; + ret = clk_hw_register(NULL, hw); + if (ret) { + kfree(clk); + hw = ERR_PTR(ret); + } + + return hw; +} diff --git a/drivers/clk/imx/clk-scu.h b/drivers/clk/imx/clk-scu.h index 09f381b..b8e91b1 100644 --- a/drivers/clk/imx/clk-scu.h +++ b/drivers/clk/imx/clk-scu.h @@ -18,4 +18,7 @@ static inline int imx_clk_scu_init(void) struct clk_hw *imx_clk_scu(const char *name, u32 rsrc_id, u8 clk_type); +struct clk_hw *imx_clk_lpcg_scu(const char *name, const char *parent_name, + unsigned long flags, void __iomem *reg, + u8 bit_idx, bool hw_gate); #endif From patchwork Wed Nov 21 14:12:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10692631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 901E713BB for ; Wed, 21 Nov 2018 14:14:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C85028DA4 for ; Wed, 21 Nov 2018 14:14:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 706A92BA97; Wed, 21 Nov 2018 14:14:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6C4872BA84 for ; Wed, 21 Nov 2018 14:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4y2oQTDIRLWSHe/LI4+GfQWziWDQiCCPMJJy2l9WwPo=; b=BHKXZexKmMKXgz 4AYVLtG+aR6VP8AW2rEbUZK1SyfLLOA6Hr70162i7c2bsfkSAOQ1kXN2PcnmEH0rq9/MkCP2W2jPJ qFRkAK7Kww6PFtYL0t0ClQ/44ronNxk9LVbOxcBEcjhinQSpA7EniwbGD5G71mSTGnHGsqgkfaC2G Way8uW+vz0yUlAv7Y1p/c+X9XRLJsGbRHAWrgrW/2UCKOytdF0g8aD/sJtAHtSOvnacxI60WphMmV k8TQq4rHkJzZ1Nwg9EpzCLeCLVAQferSqE6ZxAECbdj8idH4gVP8P0ANZhbs4d/06T4iYv7PfLeCw Z/SvvNus+HdgYrzV2iSQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTGi-0004g6-1i; Wed, 21 Nov 2018 14:14:16 +0000 Received: from mail-eopbgr60075.outbound.protection.outlook.com ([40.107.6.75] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPTFT-0002ns-GX for linux-arm-kernel@lists.infradead.org; Wed, 21 Nov 2018 14:13:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jn9yDT9E+86o4JdAa5p77vIpJve9rkRdtqBZb5h+2fs=; b=X7VA7ezR3JK/05YDyXjviA01wykdzOQ4ssDSz6E9SE7+b1Xt4+ufQD1b5I+UB7hsrRAjDLaLAcEPoZTZTIBgZV24DKFCqvr2EEhoLHjTNh8yqbqaXwYKMBoP2nxl2BDLxnZMOLvfyo916MTCbdvnSuhPYIyaFX/hVqTsOS8HLtA= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.126.21) by AM0PR04MB5076.eurprd04.prod.outlook.com (20.177.40.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.23; Wed, 21 Nov 2018 14:12:42 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::31e3:2aa6:8d93:9927%2]) with mapi id 15.20.1339.027; Wed, 21 Nov 2018 14:12:42 +0000 From: Aisheng DONG To: "linux-clk@vger.kernel.org" Subject: [PATCH V8 7/7] clk: imx: add imx8qxp lpcg driver Thread-Topic: [PATCH V8 7/7] clk: imx: add imx8qxp lpcg driver Thread-Index: AQHUgaREVEw6/mH3o0GCvRv4pkBfoQ== Date: Wed, 21 Nov 2018 14:12:41 +0000 Message-ID: <1542809234-539-8-git-send-email-aisheng.dong@nxp.com> References: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1542809234-539-1-git-send-email-aisheng.dong@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0178.apcprd02.prod.outlook.com (2603:1096:201:21::14) To AM0PR04MB4211.eurprd04.prod.outlook.com (2603:10a6:208:66::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR04MB5076; 6:m5bxduloIiJp+2HOvIqyTzPq2JhF07fnqv0RGf/v1foDnMAMTXa+oehlWBBn//qjq1RAzv4yJdIOgdB26UstsXjnh5A8GZZGTsPL/KQw9pHTpvfQGLNdEqYdFgGXHoz8N3F0HS4gaCVj1AblCVkx/x3minDU1yq3/D/NuBdpEacsINtOEgZPIymD4CB/ZFs/Mr43xzrEDNDD2YDknZqD/6csWxH4DSbN26BE3lYmahsh9QzgtqcCacKW4UaYx9O1NaWrOiDVmELbxvZXRCBxd8cHgDTDPbkfp0IoIXXgRZfPBpJVfLXpNj0ouWDckhAfScMwWr2UCp3qdEO7kyGne/EOLw3gq3RhGnaGpunHzSgHN1W2Znv4hH+40y8Rabj/kP9JuLaKRu8fFhMlam5JpOPjLSaB9xi4u1Pwu25hKwpVqFsqaFAVUQKKoPt7UAdRZvomHTCsH9w/0iIu5im8gQ==; 5:niNLQ9AOGF5woI6A/iZcU7bRyGDyrCvthCN8bBr94c2Om5z+wxoIgtEy/yME63Mwa7A2qZV63eGndHIUUMo1f4uTxNhf3anbw+tH20NnnjLlo/+/fwT9VIFY8tCJMWkHcCidv6G8vYpkey5JjqNYZn5+4rJ/aAtKZUZlIdfPNnQ=; 7:f4HQFi7jYWKGpkU/Olj+JhSC2iQby3gA8ZZTgLOOGrAk/1wf4bi0Cb2w7HuDFSBVGTqS7VqH3Ax87siRGJ5noxHvBHF7Rz8H0MvJYfvNYSc9M9yeTwZjgOmhPsshmtWjlhCHlu8AjHX4rDQsb7rTCA== x-ms-office365-filtering-correlation-id: ac8832b9-e26e-4f63-c23d-08d64fbb6676 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB5076; x-ms-traffictypediagnostic: AM0PR04MB5076: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231442)(944501410)(52105112)(93006095)(93001095)(10201501046)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:AM0PR04MB5076; BCL:0; PCL:0; RULEID:; SRVR:AM0PR04MB5076; x-forefront-prvs: 08635C03D4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(366004)(376002)(396003)(346002)(54534003)(199004)(189003)(76176011)(6916009)(52116002)(2906002)(6506007)(316002)(386003)(99286004)(8936002)(486006)(6486002)(186003)(26005)(11346002)(575784001)(6436002)(2501003)(86362001)(2616005)(5660300001)(50226002)(102836004)(71190400001)(71200400001)(446003)(5640700003)(4326008)(476003)(106356001)(478600001)(305945005)(6116002)(3846002)(25786009)(105586002)(36756003)(14454004)(81166006)(2351001)(2900100001)(53946003)(4744004)(54906003)(81156014)(7736002)(68736007)(97736004)(66066001)(8676002)(256004)(14444005)(53936002)(6512007)(32563001)(473944003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB5076; H:AM0PR04MB4211.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: PiR0MsWkqYCmVyCaSMPfHnfu8cQNvGN+Mmk6RoYsCdoC+V6YsmNdIaewfboV0Mkj5QVP1Jozwf8K4ZDqhHZtk7pTc/yX793h0wVGM4D+qsKg0piXOUzA1Tb0JbDxO52VHrQCqbcYhvTc3fi2Nh9YtT4Ru2tUDOHkI/IdSfMDki+9cV1lfkpQPMud+UGU1Dw1A5iFG9BDmVc3thI/EvN2+FDi+cVq5llJrqkpWcwuegYRwlav/X3o/oZS1HuWU7x/Ri1S8WJhqqoCKKliiOVxdrtC7z1f1p1mnAfboMJ5r4dz654AvcZOyUGcJQobkup23vkPj/LxymEEToZEuKhRkYXkGbmTWJtX+pvOaX0fRQ4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac8832b9-e26e-4f63-c23d-08d64fbb6676 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2018 14:12:42.0885 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5076 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181121_061300_488413_0C2F86F9 X-CRM114-Status: GOOD ( 17.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aisheng DONG , "sboyd@kernel.org" , "mturquette@baylibre.com" , dl-linux-imx , "kernel@pengutronix.de" , Fabio Estevam , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add imx8qxp lpcg driver support Cc: Stephen Boyd Cc: Shawn Guo Cc: Sascha Hauer Cc: Fabio Estevam Cc: Michael Turquette Signed-off-by: Dong Aisheng --- ChangeLog: v7->v8: * no changes v6->v7: * use resource_size() * add kernel doc for structs * Include this after and before locals * remove MODULE_ macros * add suppress_bind_attrs v6: * new patch, separate from scu gate driver --- drivers/clk/imx/Makefile | 2 +- drivers/clk/imx/clk-imx8qxp-lpcg.c | 216 +++++++++++++++++++++++++++++++++++++ drivers/clk/imx/clk-imx8qxp-lpcg.h | 102 ++++++++++++++++++ 3 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/imx/clk-imx8qxp-lpcg.c create mode 100644 drivers/clk/imx/clk-imx8qxp-lpcg.h diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile index cd2b6f0..96ab82b 100644 --- a/drivers/clk/imx/Makefile +++ b/drivers/clk/imx/Makefile @@ -32,4 +32,4 @@ obj-$(CONFIG_SOC_IMX6UL) += clk-imx6ul.o obj-$(CONFIG_SOC_IMX7D) += clk-imx7d.o obj-$(CONFIG_SOC_VF610) += clk-vf610.o -obj-$(CONFIG_SOC_IMX8QXP) += clk-imx8qxp.o +obj-$(CONFIG_SOC_IMX8QXP) += clk-imx8qxp.o clk-imx8qxp-lpcg.o diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c new file mode 100644 index 0000000..dcae1dd --- /dev/null +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c @@ -0,0 +1,216 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2018 NXP + * Dong Aisheng + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "clk-scu.h" +#include "clk-imx8qxp-lpcg.h" + +#include + +/* + * struct imx8qxp_lpcg_data - Description of one LPCG clock + * @id: clock ID + * @name: clock name + * @parent: parent clock name + * @flags: common clock flags + * @offset: offset of this LPCG clock + * @bit_idx: bit index of this LPCG clock + * @hw_gate: whether supports HW autogate + * + * This structure describes one LPCG clock + */ +struct imx8qxp_lpcg_data { + int id; + char *name; + char *parent; + unsigned long flags; + u32 offset; + u8 bit_idx; + bool hw_gate; +}; + +/* + * struct imx8qxp_ss_lpcg - Description of one subsystem LPCG clocks + * @lpcg: LPCG clocks array of one subsystem + * @num_lpcg: the number of LPCG clocks + * @num_max: the maximum number of LPCG clocks + * + * This structure describes each subsystem LPCG clocks information + * which then will be used to create respective LPCGs clocks + */ +struct imx8qxp_ss_lpcg { + const struct imx8qxp_lpcg_data *lpcg; + u8 num_lpcg; + u8 num_max; +}; + +static const struct imx8qxp_lpcg_data imx8qxp_lpcg_adma[] = { + { IMX8QXP_ADMA_LPCG_UART0_IPG_CLK, "uart0_lpcg_ipg_clk", "dma_ipg_clk_root", 0, ADMA_LPUART_0_LPCG, 16, 0, }, + { IMX8QXP_ADMA_LPCG_UART0_BAUD_CLK, "uart0_lpcg_baud_clk", "uart0_clk", 0, ADMA_LPUART_0_LPCG, 0, 0, }, + { IMX8QXP_ADMA_LPCG_UART1_IPG_CLK, "uart1_lpcg_ipg_clk", "dma_ipg_clk_root", 0, ADMA_LPUART_1_LPCG, 16, 0, }, + { IMX8QXP_ADMA_LPCG_UART1_BAUD_CLK, "uart1_lpcg_baud_clk", "uart1_clk", 0, ADMA_LPUART_1_LPCG, 0, 0, }, + { IMX8QXP_ADMA_LPCG_UART2_IPG_CLK, "uart2_lpcg_ipg_clk", "dma_ipg_clk_root", 0, ADMA_LPUART_2_LPCG, 16, 0, }, + { IMX8QXP_ADMA_LPCG_UART2_BAUD_CLK, "uart2_lpcg_baud_clk", "uart2_clk", 0, ADMA_LPUART_2_LPCG, 0, 0, }, + { IMX8QXP_ADMA_LPCG_UART3_IPG_CLK, "uart3_lpcg_ipg_clk", "dma_ipg_clk_root", 0, ADMA_LPUART_3_LPCG, 16, 0, }, + { IMX8QXP_ADMA_LPCG_UART3_BAUD_CLK, "uart3_lpcg_baud_clk", "uart3_clk", 0, ADMA_LPUART_3_LPCG, 0, 0, }, + { IMX8QXP_ADMA_LPCG_I2C0_IPG_CLK, "i2c0_lpcg_ipg_clk", "dma_ipg_clk_root", 0, ADMA_LPI2C_0_LPCG, 16, 0, }, + { IMX8QXP_ADMA_LPCG_I2C0_CLK, "i2c0_lpcg_clk", "i2c0_clk", 0, ADMA_LPI2C_0_LPCG, 0, 0, }, + { IMX8QXP_ADMA_LPCG_I2C1_IPG_CLK, "i2c1_lpcg_ipg_clk", "dma_ipg_clk_root", 0, ADMA_LPI2C_1_LPCG, 16, 0, }, + { IMX8QXP_ADMA_LPCG_I2C1_CLK, "i2c1_lpcg_clk", "i2c1_clk", 0, ADMA_LPI2C_1_LPCG, 0, 0, }, + { IMX8QXP_ADMA_LPCG_I2C2_IPG_CLK, "i2c2_lpcg_ipg_clk", "dma_ipg_clk_root", 0, ADMA_LPI2C_2_LPCG, 16, 0, }, + { IMX8QXP_ADMA_LPCG_I2C2_CLK, "i2c2_lpcg_clk", "i2c2_clk", 0, ADMA_LPI2C_2_LPCG, 0, 0, }, + { IMX8QXP_ADMA_LPCG_I2C3_IPG_CLK, "i2c3_lpcg_ipg_clk", "dma_ipg_clk_root", 0, ADMA_LPI2C_3_LPCG, 16, 0, }, + { IMX8QXP_ADMA_LPCG_I2C3_CLK, "i2c3_lpcg_clk", "i2c3_clk", 0, ADMA_LPI2C_3_LPCG, 0, 0, }, +}; + +static const struct imx8qxp_ss_lpcg imx8qxp_ss_adma = { + .lpcg = imx8qxp_lpcg_adma, + .num_lpcg = ARRAY_SIZE(imx8qxp_lpcg_adma), + .num_max = IMX8QXP_ADMA_LPCG_CLK_END, +}; + +static const struct imx8qxp_lpcg_data imx8qxp_lpcg_conn[] = { + { IMX8QXP_CONN_LPCG_SDHC0_PER_CLK, "sdhc0_lpcg_per_clk", "sdhc0_clk", 0, CONN_USDHC_0_LPCG, 0, 0, }, + { IMX8QXP_CONN_LPCG_SDHC0_IPG_CLK, "sdhc0_lpcg_ipg_clk", "conn_ipg_clk_root", 0, CONN_USDHC_0_LPCG, 16, 0, }, + { IMX8QXP_CONN_LPCG_SDHC0_HCLK, "sdhc0_lpcg_ahb_clk", "conn_axi_clk_root", 0, CONN_USDHC_0_LPCG, 20, 0, }, + { IMX8QXP_CONN_LPCG_SDHC1_PER_CLK, "sdhc1_lpcg_per_clk", "sdhc1_clk", 0, CONN_USDHC_1_LPCG, 0, 0, }, + { IMX8QXP_CONN_LPCG_SDHC1_IPG_CLK, "sdhc1_lpcg_ipg_clk", "conn_ipg_clk_root", 0, CONN_USDHC_1_LPCG, 16, 0, }, + { IMX8QXP_CONN_LPCG_SDHC1_HCLK, "sdhc1_lpcg_ahb_clk", "conn_axi_clk_root", 0, CONN_USDHC_1_LPCG, 20, 0, }, + { IMX8QXP_CONN_LPCG_SDHC2_PER_CLK, "sdhc2_lpcg_per_clk", "sdhc2_clk", 0, CONN_USDHC_2_LPCG, 0, 0, }, + { IMX8QXP_CONN_LPCG_SDHC2_IPG_CLK, "sdhc2_lpcg_ipg_clk", "conn_ipg_clk_root", 0, CONN_USDHC_2_LPCG, 16, 0, }, + { IMX8QXP_CONN_LPCG_SDHC2_HCLK, "sdhc2_lpcg_ahb_clk", "conn_axi_clk_root", 0, CONN_USDHC_2_LPCG, 20, 0, }, + { IMX8QXP_CONN_LPCG_ENET0_ROOT_CLK, "enet0_ipg_root_clk", "enet0_clk", 0, CONN_ENET_0_LPCG, 0, 0, }, + { IMX8QXP_CONN_LPCG_ENET0_TX_CLK, "enet0_tx_clk", "enet0_clk", 0, CONN_ENET_0_LPCG, 4, 0, }, + { IMX8QXP_CONN_LPCG_ENET0_AHB_CLK, "enet0_ahb_clk", "conn_axi_clk_root", 0, CONN_ENET_0_LPCG, 8, 0, }, + { IMX8QXP_CONN_LPCG_ENET0_IPG_S_CLK, "enet0_ipg_s_clk", "conn_ipg_clk_root", 0, CONN_ENET_0_LPCG, 20, 0, }, + { IMX8QXP_CONN_LPCG_ENET0_IPG_CLK, "enet0_ipg_clk", "enet0_ipg_s_clk", 0, CONN_ENET_0_LPCG, 16, 0, }, + { IMX8QXP_CONN_LPCG_ENET1_ROOT_CLK, "enet1_ipg_root_clk", "enet1_clk", 0, CONN_ENET_1_LPCG, 0, 0, }, + { IMX8QXP_CONN_LPCG_ENET1_TX_CLK, "enet1_tx_clk", "enet1_clk", 0, CONN_ENET_1_LPCG, 4, 0, }, + { IMX8QXP_CONN_LPCG_ENET1_AHB_CLK, "enet1_ahb_clk", "conn_axi_clk_root", 0, CONN_ENET_1_LPCG, 8, 0, }, + { IMX8QXP_CONN_LPCG_ENET1_IPG_S_CLK, "enet1_ipg_s_clk", "conn_ipg_clk_root", 0, CONN_ENET_1_LPCG, 20, 0, }, + { IMX8QXP_CONN_LPCG_ENET1_IPG_CLK, "enet1_ipg_clk", "enet0_ipg_s_clk", 0, CONN_ENET_1_LPCG, 16, 0, }, +}; + +static const struct imx8qxp_ss_lpcg imx8qxp_ss_conn = { + .lpcg = imx8qxp_lpcg_conn, + .num_lpcg = ARRAY_SIZE(imx8qxp_lpcg_conn), + .num_max = IMX8QXP_CONN_LPCG_CLK_END, +}; + +static const struct imx8qxp_lpcg_data imx8qxp_lpcg_lsio[] = { + { IMX8QXP_LSIO_LPCG_PWM0_IPG_CLK, "pwm0_lpcg_ipg_clk", "pwm0_clk", 0, LSIO_PWM_0_LPCG, 0, 0, }, + { IMX8QXP_LSIO_LPCG_PWM0_IPG_HF_CLK, "pwm0_lpcg_ipg_hf_clk", "pwm0_clk", 0, LSIO_PWM_0_LPCG, 4, 0, }, + { IMX8QXP_LSIO_LPCG_PWM0_IPG_S_CLK, "pwm0_lpcg_ipg_s_clk", "pwm0_clk", 0, LSIO_PWM_0_LPCG, 16, 0, }, + { IMX8QXP_LSIO_LPCG_PWM0_IPG_SLV_CLK, "pwm0_lpcg_ipg_slv_clk", "lsio_bus_clk_root", 0, LSIO_PWM_0_LPCG, 20, 0, }, + { IMX8QXP_LSIO_LPCG_PWM0_IPG_MSTR_CLK, "pwm0_lpcg_ipg_mstr_clk", "pwm0_clk", 0, LSIO_PWM_0_LPCG, 24, 0, }, + { IMX8QXP_LSIO_LPCG_PWM1_IPG_CLK, "pwm1_lpcg_ipg_clk", "pwm1_clk", 0, LSIO_PWM_1_LPCG, 0, 0, }, + { IMX8QXP_LSIO_LPCG_PWM1_IPG_HF_CLK, "pwm1_lpcg_ipg_hf_clk", "pwm1_clk", 0, LSIO_PWM_1_LPCG, 4, 0, }, + { IMX8QXP_LSIO_LPCG_PWM1_IPG_S_CLK, "pwm1_lpcg_ipg_s_clk", "pwm1_clk", 0, LSIO_PWM_1_LPCG, 16, 0, }, + { IMX8QXP_LSIO_LPCG_PWM1_IPG_SLV_CLK, "pwm1_lpcg_ipg_slv_clk", "lsio_bus_clk_root", 0, LSIO_PWM_1_LPCG, 20, 0, }, + { IMX8QXP_LSIO_LPCG_PWM1_IPG_MSTR_CLK, "pwm1_lpcg_ipg_mstr_clk", "pwm1_clk", 0, LSIO_PWM_1_LPCG, 24, 0, }, + { IMX8QXP_LSIO_LPCG_PWM2_IPG_CLK, "pwm2_lpcg_ipg_clk", "pwm2_clk", 0, LSIO_PWM_2_LPCG, 0, 0, }, + { IMX8QXP_LSIO_LPCG_PWM2_IPG_HF_CLK, "pwm2_lpcg_ipg_hf_clk", "pwm2_clk", 0, LSIO_PWM_2_LPCG, 4, 0, }, + { IMX8QXP_LSIO_LPCG_PWM2_IPG_S_CLK, "pwm2_lpcg_ipg_s_clk", "pwm2_clk", 0, LSIO_PWM_2_LPCG, 16, 0, }, + { IMX8QXP_LSIO_LPCG_PWM2_IPG_SLV_CLK, "pwm2_lpcg_ipg_slv_clk", "lsio_bus_clk_root", 0, LSIO_PWM_2_LPCG, 20, 0, }, + { IMX8QXP_LSIO_LPCG_PWM2_IPG_MSTR_CLK, "pwm2_lpcg_ipg_mstr_clk", "pwm2_clk", 0, LSIO_PWM_2_LPCG, 24, 0, }, + { IMX8QXP_LSIO_LPCG_PWM3_IPG_CLK, "pwm3_lpcg_ipg_clk", "pwm3_clk", 0, LSIO_PWM_3_LPCG, 0, 0, }, + { IMX8QXP_LSIO_LPCG_PWM3_IPG_HF_CLK, "pwm3_lpcg_ipg_hf_clk", "pwm3_clk", 0, LSIO_PWM_3_LPCG, 4, 0, }, + { IMX8QXP_LSIO_LPCG_PWM3_IPG_S_CLK, "pwm3_lpcg_ipg_s_clk", "pwm3_clk", 0, LSIO_PWM_3_LPCG, 16, 0, }, + { IMX8QXP_LSIO_LPCG_PWM3_IPG_SLV_CLK, "pwm3_lpcg_ipg_slv_clk", "lsio_bus_clk_root", 0, LSIO_PWM_3_LPCG, 20, 0, }, + { IMX8QXP_LSIO_LPCG_PWM3_IPG_MSTR_CLK, "pwm3_lpcg_ipg_mstr_clk", "pwm3_clk", 0, LSIO_PWM_3_LPCG, 24, 0, }, + { IMX8QXP_LSIO_LPCG_PWM4_IPG_CLK, "pwm4_lpcg_ipg_clk", "pwm4_clk", 0, LSIO_PWM_4_LPCG, 0, 0, }, + { IMX8QXP_LSIO_LPCG_PWM4_IPG_HF_CLK, "pwm4_lpcg_ipg_hf_clk", "pwm4_clk", 0, LSIO_PWM_4_LPCG, 4, 0, }, + { IMX8QXP_LSIO_LPCG_PWM4_IPG_S_CLK, "pwm4_lpcg_ipg_s_clk", "pwm4_clk", 0, LSIO_PWM_4_LPCG, 16, 0, }, + { IMX8QXP_LSIO_LPCG_PWM4_IPG_SLV_CLK, "pwm4_lpcg_ipg_slv_clk", "lsio_bus_clk_root", 0, LSIO_PWM_4_LPCG, 20, 0, }, + { IMX8QXP_LSIO_LPCG_PWM4_IPG_MSTR_CLK, "pwm4_lpcg_ipg_mstr_clk", "pwm4_clk", 0, LSIO_PWM_4_LPCG, 24, 0, }, + { IMX8QXP_LSIO_LPCG_PWM5_IPG_CLK, "pwm5_lpcg_ipg_clk", "pwm5_clk", 0, LSIO_PWM_5_LPCG, 0, 0, }, + { IMX8QXP_LSIO_LPCG_PWM5_IPG_HF_CLK, "pwm5_lpcg_ipg_hf_clk", "pwm5_clk", 0, LSIO_PWM_5_LPCG, 4, 0, }, + { IMX8QXP_LSIO_LPCG_PWM5_IPG_S_CLK, "pwm5_lpcg_ipg_s_clk", "pwm5_clk", 0, LSIO_PWM_5_LPCG, 16, 0, }, + { IMX8QXP_LSIO_LPCG_PWM5_IPG_SLV_CLK, "pwm5_lpcg_ipg_slv_clk", "lsio_bus_clk_root", 0, LSIO_PWM_5_LPCG, 20, 0, }, + { IMX8QXP_LSIO_LPCG_PWM5_IPG_MSTR_CLK, "pwm5_lpcg_ipg_mstr_clk", "pwm5_clk", 0, LSIO_PWM_5_LPCG, 24, 0, }, + { IMX8QXP_LSIO_LPCG_PWM6_IPG_CLK, "pwm6_lpcg_ipg_clk", "pwm6_clk", 0, LSIO_PWM_6_LPCG, 0, 0, }, + { IMX8QXP_LSIO_LPCG_PWM6_IPG_HF_CLK, "pwm6_lpcg_ipg_hf_clk", "pwm6_clk", 0, LSIO_PWM_6_LPCG, 4, 0, }, + { IMX8QXP_LSIO_LPCG_PWM6_IPG_S_CLK, "pwm6_lpcg_ipg_s_clk", "pwm6_clk", 0, LSIO_PWM_6_LPCG, 16, 0, }, + { IMX8QXP_LSIO_LPCG_PWM6_IPG_SLV_CLK, "pwm6_lpcg_ipg_slv_clk", "lsio_bus_clk_root", 0, LSIO_PWM_6_LPCG, 20, 0, }, + { IMX8QXP_LSIO_LPCG_PWM6_IPG_MSTR_CLK, "pwm6_lpcg_ipg_mstr_clk", "pwm6_clk", 0, LSIO_PWM_6_LPCG, 24, 0, }, +}; + +static const struct imx8qxp_ss_lpcg imx8qxp_ss_lsio = { + .lpcg = imx8qxp_lpcg_lsio, + .num_lpcg = ARRAY_SIZE(imx8qxp_lpcg_lsio), + .num_max = IMX8QXP_LSIO_LPCG_CLK_END, +}; + +static int imx8qxp_lpcg_clk_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct clk_hw_onecell_data *clk_data; + const struct imx8qxp_ss_lpcg *ss_lpcg; + const struct imx8qxp_lpcg_data *lpcg; + struct resource *res; + struct clk_hw **clks; + void __iomem *base; + int i; + + ss_lpcg = of_device_get_match_data(dev); + if (!ss_lpcg) + return -ENODEV; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap(dev, res->start, resource_size(res)); + if (!base) + return -ENOMEM; + + clk_data = devm_kzalloc(&pdev->dev, struct_size(clk_data, hws, + ss_lpcg->num_max), GFP_KERNEL); + if (!clk_data) + return -ENOMEM; + + clk_data->num = ss_lpcg->num_max; + clks = clk_data->hws; + + for (i = 0; i < ss_lpcg->num_lpcg; i++) { + lpcg = ss_lpcg->lpcg + i; + clks[lpcg->id] = imx_clk_lpcg_scu(lpcg->name, lpcg->parent, + lpcg->flags, base + lpcg->offset, + lpcg->bit_idx, lpcg->hw_gate); + } + + for (i = 0; i < clk_data->num; i++) { + if (IS_ERR(clks[i])) + pr_warn("i.MX clk %u: register failed with %ld\n", + i, PTR_ERR(clks[i])); + } + + return of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); +} + +static const struct of_device_id imx8qxp_lpcg_match[] = { + { .compatible = "fsl,imx8qxp-lpcg-adma", &imx8qxp_ss_adma, }, + { .compatible = "fsl,imx8qxp-lpcg-conn", &imx8qxp_ss_conn, }, + { .compatible = "fsl,imx8qxp-lpcg-lsio", &imx8qxp_ss_lsio, }, + { /* sentinel */ } +}; + +static struct platform_driver imx8qxp_lpcg_clk_driver = { + .driver = { + .name = "imx8qxp-lpcg-clk", + .of_match_table = imx8qxp_lpcg_match, + .suppress_bind_attrs = true, + }, + .probe = imx8qxp_lpcg_clk_probe, +}; + +builtin_platform_driver(imx8qxp_lpcg_clk_driver); diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.h b/drivers/clk/imx/clk-imx8qxp-lpcg.h new file mode 100644 index 0000000..2a37ce5 --- /dev/null +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.h @@ -0,0 +1,102 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2018 NXP + * Dong Aisheng + */ + +#ifndef _IMX8QXP_LPCG_H +#define _IMX8QXP_LPCG_H + +/*LSIO SS */ +#define LSIO_PWM_0_LPCG 0x00000 +#define LSIO_PWM_1_LPCG 0x10000 +#define LSIO_PWM_2_LPCG 0x20000 +#define LSIO_PWM_3_LPCG 0x30000 +#define LSIO_PWM_4_LPCG 0x40000 +#define LSIO_PWM_5_LPCG 0x50000 +#define LSIO_PWM_6_LPCG 0x60000 +#define LSIO_PWM_7_LPCG 0x70000 +#define LSIO_GPIO_0_LPCG 0x80000 +#define LSIO_GPIO_1_LPCG 0x90000 +#define LSIO_GPIO_2_LPCG 0xa0000 +#define LSIO_GPIO_3_LPCG 0xb0000 +#define LSIO_GPIO_4_LPCG 0xc0000 +#define LSIO_GPIO_5_LPCG 0xd0000 +#define LSIO_GPIO_6_LPCG 0xe0000 +#define LSIO_GPIO_7_LPCG 0xf0000 +#define LSIO_FSPI_0_LPCG 0x120000 +#define LSIO_FSPI_1_LPCG 0x130000 +#define LSIO_GPT_0_LPCG 0x140000 +#define LSIO_GPT_1_LPCG 0x150000 +#define LSIO_GPT_2_LPCG 0x160000 +#define LSIO_GPT_3_LPCG 0x170000 +#define LSIO_GPT_4_LPCG 0x180000 +#define LSIO_OCRAM_LPCG 0x190000 +#define LSIO_KPP_LPCG 0x1a0000 +#define LSIO_ROMCP_LPCG 0x100000 + +/* Connectivity SS */ +#define CONN_USDHC_0_LPCG 0x00000 +#define CONN_USDHC_1_LPCG 0x10000 +#define CONN_USDHC_2_LPCG 0x20000 +#define CONN_ENET_0_LPCG 0x30000 +#define CONN_ENET_1_LPCG 0x40000 +#define CONN_DTCP_LPCG 0x50000 +#define CONN_MLB_LPCG 0x60000 +#define CONN_USB_2_LPCG 0x70000 +#define CONN_USB_3_LPCG 0x80000 +#define CONN_NAND_LPCG 0x90000 +#define CONN_EDMA_LPCG 0xa0000 + +/* ADMA SS */ +#define ADMA_ASRC_0_LPCG 0x400000 +#define ADMA_ESAI_0_LPCG 0x410000 +#define ADMA_SPDIF_0_LPCG 0x420000 +#define ADMA_SAI_0_LPCG 0x440000 +#define ADMA_SAI_1_LPCG 0x450000 +#define ADMA_SAI_2_LPCG 0x460000 +#define ADMA_SAI_3_LPCG 0x470000 +#define ADMA_GPT_5_LPCG 0x4b0000 +#define ADMA_GPT_6_LPCG 0x4c0000 +#define ADMA_GPT_7_LPCG 0x4d0000 +#define ADMA_GPT_8_LPCG 0x4e0000 +#define ADMA_GPT_9_LPCG 0x4f0000 +#define ADMA_GPT_10_LPCG 0x500000 +#define ADMA_HIFI_LPCG 0x580000 +#define ADMA_OCRAM_LPCG 0x590000 +#define ADMA_EDMA_0_LPCG 0x5f0000 +#define ADMA_ASRC_1_LPCG 0xc00000 +#define ADMA_SAI_4_LPCG 0xc20000 +#define ADMA_SAI_5_LPCG 0xc30000 +#define ADMA_AMIX_LPCG 0xc40000 +#define ADMA_MQS_LPCG 0xc50000 +#define ADMA_ACM_LPCG 0xc60000 +#define ADMA_REC_CLK0_LPCG 0xd00000 +#define ADMA_REC_CLK1_LPCG 0xd10000 +#define ADMA_PLL_CLK0_LPCG 0xd20000 +#define ADMA_PLL_CLK1_LPCG 0xd30000 +#define ADMA_MCLKOUT0_LPCG 0xd50000 +#define ADMA_MCLKOUT1_LPCG 0xd60000 +#define ADMA_EDMA_1_LPCG 0xdf0000 +#define ADMA_LPSPI_0_LPCG 0x1400000 +#define ADMA_LPSPI_1_LPCG 0x1410000 +#define ADMA_LPSPI_2_LPCG 0x1420000 +#define ADMA_LPSPI_3_LPCG 0x1430000 +#define ADMA_LPUART_0_LPCG 0x1460000 +#define ADMA_LPUART_1_LPCG 0x1470000 +#define ADMA_LPUART_2_LPCG 0x1480000 +#define ADMA_LPUART_3_LPCG 0x1490000 +#define ADMA_LCD_LPCG 0x1580000 +#define ADMA_PWM_LPCG 0x1590000 +#define ADMA_LPI2C_0_LPCG 0x1c00000 +#define ADMA_LPI2C_1_LPCG 0x1c10000 +#define ADMA_LPI2C_2_LPCG 0x1c20000 +#define ADMA_LPI2C_3_LPCG 0x1c30000 +#define ADMA_ADC_0_LPCG 0x1c80000 +#define ADMA_FTM_0_LPCG 0x1ca0000 +#define ADMA_FTM_1_LPCG 0x1cb0000 +#define ADMA_FLEXCAN_0_LPCG 0x1cd0000 +#define ADMA_FLEXCAN_1_LPCG 0x1ce0000 +#define ADMA_FLEXCAN_2_LPCG 0x1cf0000 + +#endif /* _IMX8QXP_LPCG_H */