From nobody Thu Oct 31 00:19:09 2024 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01rlnn2059.outbound.protection.outlook.com [40.95.54.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1A09156F3C; Thu, 12 Sep 2024 19:44:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.95.54.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726170263; cv=fail; b=NfR+fKkQp6BZywN5zRU1H4ZEpxBaZkYhyfFLV2sc0cT2ovxASRgPlVxxQ7g06/w5dX4AzGBCIAsH5HWM4tLMGihDwATBvlEUhmzerArgmlHmJps4e/yq/F6dNkrPydLZF3YuTmd+xqK9+Tbyr8j+t/iFAkYLHUzeOcyQzsnfPls= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726170263; c=relaxed/simple; bh=qFqGHgEyyN8yUWr0qjApPEVs20oo7ZhAYqawZjFsLxk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d7uYZ8AJdaBkx6elCRnRZP+dpfjns+mf8/HdxK6pOY3oPxmCKrfFlwbBLUysdUFICCmsernpUehVdpHudcuIu4yU29jYY+DhDHniaw022SThlhOj79+3LOs/Pr59eySKoW9W6Zy1XmIqNX6VzZk2M2/Hk3NgnL8ABrFZxHxDSlg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=none smtp.mailfrom=taln60.nuvoton.co.il; dkim=pass (1024-bit key) header.d=nuvoton.onmicrosoft.com header.i=@nuvoton.onmicrosoft.com header.b=j0Zk7Ti8; arc=fail smtp.client-ip=40.95.54.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=taln60.nuvoton.co.il Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nuvoton.onmicrosoft.com header.i=@nuvoton.onmicrosoft.com header.b="j0Zk7Ti8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yzFij9GVHqYM7yfgPD1w5XPEHbygLYuYI5ewZnWrNZ/XWVOkFSjCxhJaL43zkJ4KyLZMrDH0M0oUEePoURLpZGBnawp06dNgTUPpKbLcPdSdx1yI2Ci9mbXkdNOme299zaCX3DHvRbNxqnJIbEQFCtCn9Lt62lxo9fdqPOkenPRAxMLrhCgBkK663fU8hcTcOwdmajuqE0X68JMKjNB1ty3yg6ufoZdq7jsW+2JZbPxDa8JU5jFUGWNh5Jkx7MxmvNyDwBy3QcCuKAL7g35LJwG8xqOhote1ejm9REsEPAwa2aicyVy1ew6VjQYWtJSqfL802EgnX/yWcPMdmITVZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Bsp6Fu2EwmNWI4JUeaL8+uK9d/eheOZNExD2CIqLPZk=; b=Ql8J3+g86xxSySDe6/FqG9uCnS/ugaVxfd6fo7ktsFJGlRjCNpyXmlV/BszwLy3mWUgrvhl9tu2KfCaJp/jo7eKKMWuHMGvkOCyaeaxR8Ls1Kubhs05kbl9OPlu3QlF7DbP/p6Y68eKtx0/MPrkzAluEZ5TffJA/ilfcjWYIXv6f9GWBZXmqxHW0NPekMmzP91uQbIfo3OqrFjG6GXIeB4lctHP9FPluIP30gMvjONS0STjoEr9HMdNgtkmspD+/7cTKaWLRwNT8pScueJnyyCLba72GOqW1LQj8ZeSOzLChNXa5czvdtJHEglihT8HfNtDdqwopu53O8ruHn58A3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 211.75.126.7) smtp.rcpttodomain=baylibre.com smtp.mailfrom=taln60.nuvoton.co.il; dmarc=fail (p=none sp=quarantine pct=100) action=none header.from=gmail.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuvoton.onmicrosoft.com; s=selector2-nuvoton-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bsp6Fu2EwmNWI4JUeaL8+uK9d/eheOZNExD2CIqLPZk=; b=j0Zk7Ti8+R8tdPxFb9oEiF8bGF0AArNx38rhls1a4HKmM2VizTeXklrwj70JdFhzrOyHBK6IsKPq7xykue0e5aneAR/b7uA4tQqgV0gFqmXp98qxH6bQ9fDecCg23O5E2xC25SwVx1K9ueKDSKITbSrD9MUpmVL1c2vXL0TQhE4= Received: from SI2P153CA0006.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::22) by OSQPR03MB8525.apcprd03.prod.outlook.com (2603:1096:604:27f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Thu, 12 Sep 2024 19:10:44 +0000 Received: from SG1PEPF000082E1.apcprd02.prod.outlook.com (2603:1096:4:140:cafe::b2) by SI2P153CA0006.outlook.office365.com (2603:1096:4:140::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.7 via Frontend Transport; Thu, 12 Sep 2024 19:10:43 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 211.75.126.7) smtp.mailfrom=taln60.nuvoton.co.il; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=gmail.com; Received-SPF: None (protection.outlook.com: taln60.nuvoton.co.il does not designate permitted sender hosts) Received: from NTHCCAS01.nuvoton.com (211.75.126.7) by SG1PEPF000082E1.mail.protection.outlook.com (10.167.240.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Thu, 12 Sep 2024 19:10:41 +0000 Received: from NTHCCAS01.nuvoton.com (10.1.8.28) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 13 Sep 2024 03:10:41 +0800 Received: from taln58.nuvoton.co.il (10.191.1.178) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 13 Sep 2024 03:10:40 +0800 Received: from taln60.nuvoton.co.il (taln60 [10.191.1.180]) by taln58.nuvoton.co.il (Postfix) with ESMTP id 172035F5DF; Thu, 12 Sep 2024 22:10:40 +0300 (IDT) Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id 099F7DC0AFB; Thu, 12 Sep 2024 22:10:40 +0300 (IDT) From: Tomer Maimon To: , , , , , , , , , CC: , , , , Tomer Maimon , Rob Herring Subject: [PATCH v28 1/3] dt-bindings: reset: npcm: add clock properties Date: Thu, 12 Sep 2024 22:10:36 +0300 Message-ID: <20240912191038.981105-2-tmaimon77@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240912191038.981105-1-tmaimon77@gmail.com> References: <20240912191038.981105-1-tmaimon77@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NotSetDelaration: True X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG1PEPF000082E1:EE_|OSQPR03MB8525:EE_ X-MS-Office365-Filtering-Correlation-Id: b13ddcea-fe15-49e3-2d04-08dcd35e98a0 X-MS-Exchange-SenderADCheck: 2 X-MS-Exchange-AntiSpam-Relay: 1 X-Microsoft-Antispam: BCL:0;ARA:13230040|7093399012|35950700016|376014|48200799018|61400799027|7416014|82310400026|921020|35450700002; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?VgT0GRj0A2bCmQgKhohwicOTBrCAcwuIS1wXiVdhXrSRlyuJH5nO8NPeoszA?= =?us-ascii?Q?3TrIDR49lRj9RZGTdOapgx3nnFEVALgrdyprzYDSWJVP5La/8PiqnOD0tS7m?= =?us-ascii?Q?gmSenPB3R50sw8IJme979Atkmtk8WihnzTjdVsPwITXf9jUnmGFrSVZj93Hd?= =?us-ascii?Q?AsKyqfABc5T61488rK3JfxjzWTQQTie73aZGgOD9nCSInquM7HEM7ZRLlUqB?= =?us-ascii?Q?mwQsusn7BYHPyVe4PBiisP/MafJnY/OMUzrpTQTQzgc8YpjnxNslnSCkOSFK?= =?us-ascii?Q?WMHvrmFmdKpj6GUVAMKzYoudDN1L7rG5CvKyfjHcJsbqT9cjcPXAfNAk2s8j?= =?us-ascii?Q?+hk4eAhqg0e7qk0mJOEkrFFv0Lwz9UJmN4L0ZKzq/YwaSpV00ibdKVL0Te72?= =?us-ascii?Q?pk+gHpVnrWY10foeZAOPg/135q5eoT0BjHOk8ShFJKiEQUebPnBTJssyKxOY?= =?us-ascii?Q?ksWLtOgIF+2G+LXjvdcnCdgvzEMAAfziXgVkXh6n68FgnHGbJngqxeh7bFuU?= =?us-ascii?Q?NIV2ul1MbuD7PmEhwUFG9DMwu0rxBPo4I3yYiKAo6o7JrSuMyBo+KiX0i2Ec?= =?us-ascii?Q?Z7F+ki+a2NoISrEmZ+zhJXzB7eYEnCCh7v7FIc/88+4wHfVsfS1t7cRjMn3T?= =?us-ascii?Q?jkCCUG7tBCs/hNgc7Ei7RX3L94ujJ25l8KFajdsJ7g9t5IQ4KVzcGmNjxDdE?= =?us-ascii?Q?dPcMl2FQ9vSRXrcehHLzlMz5ceOBXH0BPkV8O39ZpTLHrKBqZkpC12UN8qpj?= =?us-ascii?Q?0plbSD8Q3VT6n4a9tA+1PxbOgaooaKyasLIbB6UXV+WZ51JGSs2TP1FAxHpK?= =?us-ascii?Q?Y7KsqLZUmSoq8zn5Vj4rGQxV4CVzjHhvmHo8TXU2lwhpJTrukhnIAz3ESbc4?= =?us-ascii?Q?UgfeR+kgo22zN9gl1qRc+MhqB9jo1FYc4kJpgCdkRycYWvN8CZsMW606buQp?= =?us-ascii?Q?44R/Yhv+O8LO42B0sqXdYExZIbPVH5fUGOyKjLFhPBnnzN9j8hnaQ41HCYJw?= =?us-ascii?Q?6S5SwkerSNkRwxBTlR3n4jYeR7n2unyAJbMBgbXMnGtEA1IhKRdu2HckZLdB?= =?us-ascii?Q?EjRPYFAeNF+/jEHODnBBnVIitQ8OEwnShqF7SxVBiWXYMF6McIa5NMHye6cX?= =?us-ascii?Q?rhELG061trHDCYUugv//HEosHTaghCSn/cCCK2304X4LVoJfi/t8Gx6P4o4L?= =?us-ascii?Q?Z/8i+Pnhq+2LcYwl4cXP1DThUlx2IaHBoRPpxyKbwilqP5rIEmniLmxGgF0d?= =?us-ascii?Q?C0OLRlvQ+AT2HrljA1BGSXsP28cgQ6N0OL2W3O0qC9fUxfkwZcqUV3QzUIhY?= =?us-ascii?Q?5O4XwLYminZhupscAo9/RGc5XkIZXzHQAOVXGrDYwgddLxMG4/OYJ1RghH8X?= =?us-ascii?Q?lmalABH8iM8JubSiKqlsE3W+yE0u3fwxSPKlPjCqwZVixh11BtkZ0weeqbQu?= =?us-ascii?Q?rAgURSggraiH+I6Kwx7pNmODA5x3qiuolb/y63zUdW7OrGQ/V+SgNUJZZ0lC?= =?us-ascii?Q?bpJgqY619XOTjyo=3D?= X-Forefront-Antispam-Report: CIP:211.75.126.7;CTRY:TW;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:NTHCCAS01.nuvoton.com;PTR:211-75-126-7.hinet-ip.hinet.net;CAT:NONE;SFS:(13230040)(7093399012)(35950700016)(376014)(48200799018)(61400799027)(7416014)(82310400026)(921020)(35450700002);DIR:OUT;SFP:1022; X-OriginatorOrg: nuvoton.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2024 19:10:41.9694 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b13ddcea-fe15-49e3-2d04-08dcd35e98a0 X-MS-Exchange-CrossTenant-Id: a3f24931-d403-4b4a-94f1-7d83ac638e07 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a3f24931-d403-4b4a-94f1-7d83ac638e07;Ip=[211.75.126.7];Helo=[NTHCCAS01.nuvoton.com] X-MS-Exchange-CrossTenant-AuthSource: SG1PEPF000082E1.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSQPR03MB8525 Content-Type: text/plain; charset="utf-8" This commit adds a 25MHz reference clock and clock-cell properties to the NPCM reset document. The addition is necessitated by the integration of the NPCM8xx clock auxiliary bus device into the NPCM reset driver. The inclusion of the NPCM8xx clock properties in the reset document is crucial as the reset block also serves as a clock provider for the NPCM8xx clock. This enhancement is intended to facilitate the use of the NPCM8xx clock driver. Signed-off-by: Tomer Maimon Reviewed-by: Rob Herring --- .../bindings/reset/nuvoton,npcm750-reset.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/reset/nuvoton,npcm750-reset.= yaml b/Documentation/devicetree/bindings/reset/nuvoton,npcm750-reset.yaml index d82e65e37cc0..72523f1bbc18 100644 --- a/Documentation/devicetree/bindings/reset/nuvoton,npcm750-reset.yaml +++ b/Documentation/devicetree/bindings/reset/nuvoton,npcm750-reset.yaml @@ -21,6 +21,13 @@ properties: '#reset-cells': const: 2 =20 + '#clock-cells': + const: 1 + + clocks: + items: + - description: specify external 25MHz reference clock. + nuvoton,sysgcr: $ref: /schemas/types.yaml#/definitions/phandle description: a phandle to access GCR registers. @@ -39,6 +46,17 @@ required: - '#reset-cells' - nuvoton,sysgcr =20 +if: + properties: + compatible: + contains: + enum: + - nuvoton,npcm845-reset +then: + required: + - '#clock-cells' + - clocks + additionalProperties: false =20 examples: --=20 2.34.1 From nobody Thu Oct 31 00:19:09 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01rlnn2069.outbound.protection.outlook.com [40.95.53.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91A141B1507; Fri, 13 Sep 2024 04:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.95.53.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726202687; cv=fail; b=DkKmkwVlgdRN+9lewSZb07eO1g0PuGUX7ATj5a4L0d+Y50aC8v0xbIFQytm+2R6Jm4Cl478bJpFVPWRlAtR4wWPDrfi3/ab1jLMjrqxhQnAio++Cvri79jOWLZz47q008XC61Fp0SMYrRIV304/VTf+4qAG5aHDvZRm2NC3NO74= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726202687; c=relaxed/simple; bh=DtplKbtJPvbYrzp+n9caDwmRbhmbOy9oBZYrtvOqzoQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j7uubyLGMIi+mascD9op1yuO6S3i4WXj6fuqbUl1tnhWNJTrdV0e8g6t1J3rvQ642MnrBcO7fl1ktEBMYCIrt3IAg/Tc0o4nWlN8omdu7g90bM/T+dHG1qsBPPPQ/5fa3FS3IE7rovFucMs84FKZ78EDwopwu8Roj4Rj16neOkc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=none smtp.mailfrom=taln60.nuvoton.co.il; dkim=pass (1024-bit key) header.d=nuvoton.onmicrosoft.com header.i=@nuvoton.onmicrosoft.com header.b=N4cU0z/Q; arc=fail smtp.client-ip=40.95.53.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=taln60.nuvoton.co.il Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nuvoton.onmicrosoft.com header.i=@nuvoton.onmicrosoft.com header.b="N4cU0z/Q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AnRg4FO26oCp0YqbtBhPbTN4KQ2KE1ygh6wqv5sUJsIvmfeGh65JgiVFYITQunn83C3NYIr99pbXjzLWfagKncNLA5K1HNvN5bZjlci3HEGZw+YAo4OeNDvIN9QHSbVwnJormFdG7mHb5IVLJ3R8iF3s2doVewX7Tj8TPu9LC9SUOXW8P8hgyJCmiphQegkbD2QcdBv1S4BX1BURAJflbloOoxHF5qT429j8PZYlz2uIasgOb64c3VGWgRSm8cf3meumxtnsZYaKvNCct9ltD9sPqsgvvHRy3lb9akm9MOw2zP8eRE4KAHsphaZUAQ/ew4kHJoyX9UQpzV5qZOnAqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gY/VwM51W7Jix8sfRhkDAfFEL23WDjCVpVbOm7Lwv6c=; b=yfl8YKR5IdUBryW9lt9dLBabzKfdQ8NnWITezPPfTd6x+AnQBgNPU+g185VWtavpwtNPiIiwrrrACqoBhgITBQqtdBxwia1TzYCaK4DHGgDlvmeSpYS3y7Fgz0p3J4uG0UfH8kxx1rXU2lmQkX+YOpo4nY8ZU4Kx5+KB908DPKxybilcVx11SvontPtbxHEVUkbK5/GJIvK5Itlm2wuCt2yMel7f+qvCHYrRlE+RjcEZy60zgwTGope8YFBs+u59ydgKcoldhLcVyVG69yoA0D+8Xgf4fpU4asXZ1lNHd+uUWuNcpvmu3TijTtbkZriyT/XqzT8iVnGSjGhSGF6D2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 211.75.126.7) smtp.rcpttodomain=baylibre.com smtp.mailfrom=taln60.nuvoton.co.il; dmarc=fail (p=none sp=quarantine pct=100) action=none header.from=gmail.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuvoton.onmicrosoft.com; s=selector2-nuvoton-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gY/VwM51W7Jix8sfRhkDAfFEL23WDjCVpVbOm7Lwv6c=; b=N4cU0z/Qg8FpR5gweMuq81D4UYkUUF4h73xUedn7mi+gFTq8TEDlZKZaX8rt6T5SV7ImFVTYHXQujsiMiL+hJhCOR4PPXr4u0hSjr0BGQVd86CxfmLPCuR4Pns9c7hZdqfEgf1EMyF0ulpOkazXZNwI1udPmzlpOCI9Svm1EiVw= Received: from SI2P153CA0010.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::13) by TYZPR03MB7364.apcprd03.prod.outlook.com (2603:1096:400:420::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.23; Thu, 12 Sep 2024 19:10:45 +0000 Received: from SG1PEPF000082E1.apcprd02.prod.outlook.com (2603:1096:4:140:cafe::20) by SI2P153CA0010.outlook.office365.com (2603:1096:4:140::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.7 via Frontend Transport; Thu, 12 Sep 2024 19:10:45 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 211.75.126.7) smtp.mailfrom=taln60.nuvoton.co.il; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=gmail.com; Received-SPF: None (protection.outlook.com: taln60.nuvoton.co.il does not designate permitted sender hosts) Received: from NTHCCAS01.nuvoton.com (211.75.126.7) by SG1PEPF000082E1.mail.protection.outlook.com (10.167.240.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Thu, 12 Sep 2024 19:10:45 +0000 Received: from NTHCML01A.nuvoton.com (10.1.8.177) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 13 Sep 2024 03:10:41 +0800 Received: from NTHCCAS01.nuvoton.com (10.1.8.28) by NTHCML01A.nuvoton.com (10.1.8.177) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 13 Sep 2024 03:10:41 +0800 Received: from taln58.nuvoton.co.il (10.191.1.178) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 13 Sep 2024 03:10:40 +0800 Received: from taln60.nuvoton.co.il (taln60 [10.191.1.180]) by taln58.nuvoton.co.il (Postfix) with ESMTP id 1C3F15F621; Thu, 12 Sep 2024 22:10:40 +0300 (IDT) Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id 15445DC13FC; Thu, 12 Sep 2024 22:10:40 +0300 (IDT) From: Tomer Maimon To: , , , , , , , , , CC: , , , , Tomer Maimon Subject: [PATCH v28 2/3] reset: npcm: register npcm8xx clock auxiliary bus device Date: Thu, 12 Sep 2024 22:10:37 +0300 Message-ID: <20240912191038.981105-3-tmaimon77@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240912191038.981105-1-tmaimon77@gmail.com> References: <20240912191038.981105-1-tmaimon77@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NotSetDelaration: True X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG1PEPF000082E1:EE_|TYZPR03MB7364:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f34d21b-8f61-47a7-16e7-08dcd35e9a90 X-MS-Exchange-SenderADCheck: 2 X-MS-Exchange-AntiSpam-Relay: 1 X-Microsoft-Antispam: BCL:0;ARA:13230040|35950700016|48200799018|82310400026|7093399012|7416014|376014|61400799027|921020|35450700002; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?FqT7hBDPJ31fs5i11a815/p+NayDkeQ3qCv/DXp0U76cWs5I0ELnGgN6EWl5?= =?us-ascii?Q?BrtCeUdhZYteev+PuKGnXjmnDiExifM1mjq+tZdOCYGuL0X59HS44HE78hZu?= =?us-ascii?Q?VWjw4q/1MtVAZdt1KjvC285iUXgFK4YterCx7ki8p4mCc7PalZiuoAdlmaj0?= =?us-ascii?Q?7YyqF43LYnxXZb6jLI3HMoTvegD8jRPH+ZRlVVoAr1ETo41N91QAxaGO1DxY?= =?us-ascii?Q?/XazJN1yzooIPjVTGW+nfj5foukPwN4w6VYhZwAuWa+wKWx7rcNFSWgl+yC2?= =?us-ascii?Q?Bbqm+87Dp2rx9A11OH8ZW46a5sIURZ5NAwssyN0JGw2UNh/FoKF5TsGvqxmV?= =?us-ascii?Q?ueJy1Ethyo55h5Uhl2Om+bu80rmAQFvx6RKgU19EJEebRYBTCFQpWQjYCkA4?= =?us-ascii?Q?tPNPn7X/W94ML9w1AhVxN+izF8zPcPk2ylsZ1UpHfYWrMN5+sdhrqN+Qr1jW?= =?us-ascii?Q?tLu7CD4bp0U9aVNXS6juHXXrCtksl6A3sbfOkOTSfNvabVFkUQ+ytCSAvw8O?= =?us-ascii?Q?MmtHTKbpH+GporOMtYkPvGF2OK4DYY6qgPE802kUuDxGI3QjfSoP/TnmQa7H?= =?us-ascii?Q?gW77GQauFiOtVbibN6qEBINXjLS0EYA7FeXTNuI+9+3HZx1wa5RfBLu1aGd4?= =?us-ascii?Q?iLBmPsiRrLHKtvjDlE01vnKYdMoaIxigcWCe2WDTRssl0K3AV2q1qM9v1kl6?= =?us-ascii?Q?wrFV5dvxN0ioj2r+M1kyHTAwmTu/nz3VOzT2uphSTYuZRZth9F1KmADBIKaz?= =?us-ascii?Q?DUQ+7CLH6PHUZITp4lzrTHriiXaEuyIQ2t5TFnQlbYZ3lU6s7OjXwPrqS48F?= =?us-ascii?Q?4A0SjlcmY8iXMVdXUaUAVMd5r/+oGgWFJMSU1gm9LQ6vRDcPpGRA0UjljEIq?= =?us-ascii?Q?iqf5FhSVns0UzFI/gE7CZLriPeJzoA7QIb+Hh0NDiKKAMQeKaMnNZSabvkVG?= =?us-ascii?Q?wnoSEbraSKgRwTShpbtaCfAw69iD8tYrm/+6y7rYM8VxpYDeoy3WPAbwDbmG?= =?us-ascii?Q?6/9PWvE/z8fpbhOhXecaml7RLXQp5ZhDbCtjaSN1WvE4cEacNiN/wHzKD7Ox?= =?us-ascii?Q?VJciuZ4vh+oJREC6yKtBGYSRxlfqefv5bk8SWOCYlFgpEaYvRTKXzDCZ61Cu?= =?us-ascii?Q?dDBXI0kvuDa3I2BPc+KZ0mpJZ8Z0scdmcnIdVz9Z/eab9nzQQ7qZTeVhsp8O?= =?us-ascii?Q?FuQYW4/i7IyqAvwSnqW9AgnxAecgzwfsrqzopILw44wFEK4vON1T0J8RWwfd?= =?us-ascii?Q?0aBkGgNL15+jwaLKZAziWRflgDH3UglQgogRqGI7lhXunqVpKqVIlJbJ3esY?= =?us-ascii?Q?DN9O06fesNJTOjVG1mRc3MHNxYYY8Ecf8SF17cMavOG2p5Y72RXYbov395T4?= =?us-ascii?Q?OAzP6pVhHiz7GDwXjc1AkXpBKiZw835qs/B9H6c11M62b/5gZeD9Lo0Z+jVH?= =?us-ascii?Q?CWnrA2d42AIabUvzn5Halag9knO18mm16R20jsQNb3Bs7DmRB2FsVwHUR/Uf?= =?us-ascii?Q?MOWcdnFe+RRaaEI=3D?= X-Forefront-Antispam-Report: CIP:211.75.126.7;CTRY:TW;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:NTHCCAS01.nuvoton.com;PTR:211-75-126-7.hinet-ip.hinet.net;CAT:NONE;SFS:(13230040)(35950700016)(48200799018)(82310400026)(7093399012)(7416014)(376014)(61400799027)(921020)(35450700002);DIR:OUT;SFP:1022; X-OriginatorOrg: nuvoton.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2024 19:10:45.2194 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f34d21b-8f61-47a7-16e7-08dcd35e9a90 X-MS-Exchange-CrossTenant-Id: a3f24931-d403-4b4a-94f1-7d83ac638e07 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a3f24931-d403-4b4a-94f1-7d83ac638e07;Ip=[211.75.126.7];Helo=[NTHCCAS01.nuvoton.com] X-MS-Exchange-CrossTenant-AuthSource: SG1PEPF000082E1.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR03MB7364 Content-Type: text/plain; charset="utf-8" Add NPCM8xx clock controller auxiliary bus device registration. The NPCM8xx clock controller is registered as an aux device because the reset and the clock controller share the same register region. Signed-off-by: Tomer Maimon Tested-by: Benjamin Fair Reviewed-by: Philipp Zabel --- drivers/reset/Kconfig | 1 + drivers/reset/reset-npcm.c | 78 ++++++++++++++++++++++++++++- include/soc/nuvoton/clock-npcm8xx.h | 18 +++++++ 3 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 include/soc/nuvoton/clock-npcm8xx.h diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 67bce340a87e..c6bf5275cca2 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -157,6 +157,7 @@ config RESET_MESON_AUDIO_ARB config RESET_NPCM bool "NPCM BMC Reset Driver" if COMPILE_TEST default ARCH_NPCM + select AUXILIARY_BUS help This enables the reset controller driver for Nuvoton NPCM BMC SoCs. diff --git a/drivers/reset/reset-npcm.c b/drivers/reset/reset-npcm.c index 8935ef95a2d1..4f3b9fc58de0 100644 --- a/drivers/reset/reset-npcm.c +++ b/drivers/reset/reset-npcm.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Nuvoton Technology corporation. =20 +#include #include #include #include @@ -10,11 +11,14 @@ #include #include #include +#include #include #include #include #include =20 +#include + /* NPCM7xx GCR registers */ #define NPCM_MDLR_OFFSET 0x7C #define NPCM7XX_MDLR_USBD0 BIT(9) @@ -89,6 +93,7 @@ struct npcm_rc_data { const struct npcm_reset_info *info; struct regmap *gcr_regmap; u32 sw_reset_number; + struct device *dev; void __iomem *base; spinlock_t lock; }; @@ -372,6 +377,67 @@ static const struct reset_control_ops npcm_rc_ops =3D { .status =3D npcm_rc_status, }; =20 +static void npcm_clock_unregister_adev(void *_adev) +{ + struct auxiliary_device *adev =3D _adev; + + auxiliary_device_delete(adev); + auxiliary_device_uninit(adev); +} + +static void npcm_clock_adev_release(struct device *dev) +{ + struct auxiliary_device *adev =3D to_auxiliary_dev(dev); + struct npcm_clock_adev *rdev =3D to_npcm_clock_adev(adev); + + kfree(rdev); +} + +static struct auxiliary_device *npcm_clock_adev_alloc(struct npcm_rc_data = *rst_data, char *clk_name) +{ + struct npcm_clock_adev *rdev; + struct auxiliary_device *adev; + int ret; + + rdev =3D kzalloc(sizeof(*rdev), GFP_KERNEL); + if (!rdev) + return ERR_PTR(-ENOMEM); + + rdev->base =3D rst_data->base; + + adev =3D &rdev->adev; + adev->name =3D clk_name; + adev->dev.parent =3D rst_data->dev; + adev->dev.release =3D npcm_clock_adev_release; + adev->id =3D 555u; + + ret =3D auxiliary_device_init(adev); + if (ret) { + kfree(rdev); + return ERR_PTR(ret); + } + + return adev; +} + +static int npcm8xx_clock_controller_register(struct npcm_rc_data *rst_data= , char *clk_name) +{ + struct auxiliary_device *adev; + int ret; + + adev =3D npcm_clock_adev_alloc(rst_data, clk_name); + if (IS_ERR(adev)) + return PTR_ERR(adev); + + ret =3D auxiliary_device_add(adev); + if (ret) { + auxiliary_device_uninit(adev); + return ret; + } + + return devm_add_action_or_reset(rst_data->dev, npcm_clock_unregister_adev= , adev); +} + static int npcm_rc_probe(struct platform_device *pdev) { struct npcm_rc_data *rc; @@ -392,6 +458,7 @@ static int npcm_rc_probe(struct platform_device *pdev) rc->rcdev.of_node =3D pdev->dev.of_node; rc->rcdev.of_reset_n_cells =3D 2; rc->rcdev.of_xlate =3D npcm_reset_xlate; + rc->dev =3D &pdev->dev; =20 ret =3D devm_reset_controller_register(&pdev->dev, &rc->rcdev); if (ret) { @@ -408,12 +475,19 @@ static int npcm_rc_probe(struct platform_device *pdev) rc->restart_nb.priority =3D 192, rc->restart_nb.notifier_call =3D npcm_rc_restart, ret =3D register_restart_handler(&rc->restart_nb); - if (ret) + if (ret) { dev_warn(&pdev->dev, "failed to register restart handler\n"); + return ret; + } } } =20 - return ret; + switch (rc->info->bmc_id) { + case BMC_NPCM8XX: + return npcm8xx_clock_controller_register(rc, "clk-npcm8xx"); + default: + return 0; + } } =20 static struct platform_driver npcm_rc_driver =3D { diff --git a/include/soc/nuvoton/clock-npcm8xx.h b/include/soc/nuvoton/cloc= k-npcm8xx.h new file mode 100644 index 000000000000..1d974e89d8a8 --- /dev/null +++ b/include/soc/nuvoton/clock-npcm8xx.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __SOC_NPCM8XX_CLOCK_H +#define __SOC_NPCM8XX_CLOCK_H + +#include +#include + +struct npcm_clock_adev { + void __iomem *base; + struct auxiliary_device adev; +}; + +static inline struct npcm_clock_adev *to_npcm_clock_adev(struct auxiliary_= device *_adev) +{ + return container_of(_adev, struct npcm_clock_adev, adev); +} + +#endif --=20 2.34.1 From nobody Thu Oct 31 00:19:09 2024 Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazrln10220002.outbound.protection.outlook.com [52.103.192.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0243A2C80; Thu, 12 Sep 2024 21:44:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.103.192.2 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726177484; cv=fail; b=rEMJmzC6Td4vLBA5QYWqaiiU6DO7lVDLGGgDI4MQxoBzPHDGyTkDigONi8gN3NvRN0W5jKBK/1xsc/79y3fnlYpD8uml//kCJoajiDnBLZ1pYSIHQj3gscPx37JjZxYa7YR4r8lvTMR6Ofu0TqzHbgS7qyCu1rs0B9ArkQingNI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726177484; c=relaxed/simple; bh=OykJf/+w3rzOfF+wZRtjEb5+6+4Ny8YiZSFmJ0OUqBs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kQQiT320VJ6HwpW6DKZ1sArAGl7I+t/0x79F3ik2O4BDRqbtokSxbSJKPtLy767cZilrJBWchShFssj+9GxhhX2DN5HQivMPF/vlnvy71AlaGOUKFe275FB+QbcflrnUllKhG6JsXr+hpz60obA/AUuf8R+gvH7lmtjEVtRS/D8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=none smtp.mailfrom=taln60.nuvoton.co.il; dkim=pass (1024-bit key) header.d=nuvoton.onmicrosoft.com header.i=@nuvoton.onmicrosoft.com header.b=V6KiqOkg; arc=fail smtp.client-ip=52.103.192.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=taln60.nuvoton.co.il Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nuvoton.onmicrosoft.com header.i=@nuvoton.onmicrosoft.com header.b="V6KiqOkg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rI+66piJqjSpxJ5lFYzCvmj8j0gtu768MEOiGAWOqWTKUyDXLZnvWYszUfGCkiTxyqeKK3nRw+F6W0CuLDMKCarUdIPuO6N1oHp++ZropBcfMlsQpME2XHV0INZKZl4HhLjN8MgbwKGt2BsrSix0hL2YN2/W6i+tQAMmUCnVkCYh17VTIk4aYkCVQwtGH7x4KefW95cJyCYxwGdAV8nUPiR8KdJsaC0q29UJpkotA5svfUceZUbpHTXq2AHIaZ+PI5xVgorTR9MLYoL0ktgbKPgBGFUFKfo9G0byxGUkDsh38RkvMEZ6lM2YczdwKr5qcyqIq5YdnK40GN7qVwg85w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BleYNzqeBhbUWlftD+xYBcElw3W8s17V2KOudDr6CLw=; b=a8tlCGdDiLKL/1pYRZyZ7GpudP+3+rCGRfCdV7ZE7BLCgf5oQhamIVCX2QcwDQ5SSkHXLVx+1nQowPFzmw1rBEPkaKIZ5pQ5FzO1vX69O0GkpPIFdqs9fIFcf0IUwSv7rym9GXJY8N3Fi6sbqoHTTLfqvgc0HOKKb95tM0irSdg71wY6xc6lIwxqH0/2DnDplKOhBmhOtfcphHXjAJNHJLApEinnr8xuP6R6e/JXOmOzyQApqy85gG1vt/DLyQP4wLQmfFK1M8VRnTbFccO4tJfl1RLpBzquDepHYeOrve8x7yG99GxDuaKwmWN2LSkTsbIYM9Npg0v2fk1/UjpUFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 211.75.126.7) smtp.rcpttodomain=baylibre.com smtp.mailfrom=taln60.nuvoton.co.il; dmarc=fail (p=none sp=quarantine pct=100) action=none header.from=gmail.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuvoton.onmicrosoft.com; s=selector2-nuvoton-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BleYNzqeBhbUWlftD+xYBcElw3W8s17V2KOudDr6CLw=; b=V6KiqOkg7ZHvFsKAZvhCilHDkjVTYAiTQ1sulscEwRSRw+lQildqExOqZXWThy4bDkJfIayaFimwBYCT4XbTVPdeiejBjOmGKThP+Xy7R7A5oMBUGnfvtImmJxPMFxZCvQpeOIgde+bkYFw6ynGX6va4eh6pK/SHgpJB6AWe/d8= Received: from SI2P153CA0015.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::21) by TYSPR03MB7738.apcprd03.prod.outlook.com (2603:1096:400:414::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.23; Thu, 12 Sep 2024 19:10:47 +0000 Received: from SG1PEPF000082E1.apcprd02.prod.outlook.com (2603:1096:4:140:cafe::14) by SI2P153CA0015.outlook.office365.com (2603:1096:4:140::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.9 via Frontend Transport; Thu, 12 Sep 2024 19:10:46 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 211.75.126.7) smtp.mailfrom=taln60.nuvoton.co.il; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=gmail.com; Received-SPF: None (protection.outlook.com: taln60.nuvoton.co.il does not designate permitted sender hosts) Received: from NTHCCAS01.nuvoton.com (211.75.126.7) by SG1PEPF000082E1.mail.protection.outlook.com (10.167.240.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Thu, 12 Sep 2024 19:10:46 +0000 Received: from NTHCML01B.nuvoton.com (10.1.8.178) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 13 Sep 2024 03:10:41 +0800 Received: from NTHCCAS01.nuvoton.com (10.1.8.28) by NTHCML01B.nuvoton.com (10.1.8.178) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 13 Sep 2024 03:10:41 +0800 Received: from taln58.nuvoton.co.il (10.191.1.178) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 13 Sep 2024 03:10:40 +0800 Received: from taln60.nuvoton.co.il (taln60 [10.191.1.180]) by taln58.nuvoton.co.il (Postfix) with ESMTP id 244D75F64D; Thu, 12 Sep 2024 22:10:40 +0300 (IDT) Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id 21749DC0800; Thu, 12 Sep 2024 22:10:40 +0300 (IDT) From: Tomer Maimon To: , , , , , , , , , CC: , , , , Tomer Maimon Subject: [PATCH v28 3/3] clk: npcm8xx: add clock controller Date: Thu, 12 Sep 2024 22:10:38 +0300 Message-ID: <20240912191038.981105-4-tmaimon77@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240912191038.981105-1-tmaimon77@gmail.com> References: <20240912191038.981105-1-tmaimon77@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NotSetDelaration: True X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG1PEPF000082E1:EE_|TYSPR03MB7738:EE_ X-MS-Office365-Filtering-Correlation-Id: f40bfa0f-03f2-431a-e511-08dcd35e9b80 X-MS-Exchange-SenderADCheck: 2 X-MS-Exchange-AntiSpam-Relay: 1 X-Microsoft-Antispam: BCL:0;ARA:13230040|35950700016|48200799018|82310400026|7093399012|7416014|376014|61400799027|921020|35450700002; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?raEIXBHUlaho+UseuVtBDTa1qtYC3G4fY/3fpkPg8yd2rRo1i1VFtbKZ8IPJ?= =?us-ascii?Q?uZr7c15VzW+gd7Ag3caIge7vBapRv8AJfqp/j7QNVAjoxZE1PkZqdBt6eTq6?= =?us-ascii?Q?W7D71EbNg+Oam3lBNuO0vQG7Y/LnvFye0z1acWZAzvBSGz+eNzcqqBqBd5vr?= =?us-ascii?Q?hpzBnrJYWrGMGL+s9EhT0xrFiC/l8AEQ7bNEs+MIo54wFA/j319NKXhPocGQ?= =?us-ascii?Q?aK3WPn5ezQwsbx4a4aWDj9AU6+kwgE9ky5qKSBRhRgT1YOW9hwrldVyZwgL6?= =?us-ascii?Q?PaUQaKanipaeGzBqmManeYXHlIh+yoBmUUWGocZktPZ7HOFbOeGw+yL4touu?= =?us-ascii?Q?TrD4OOP6lVZeksWSf+EN5WW0pMSDd1pWG61FN/Hp8V4zOs8IuuN3P4hEA6p5?= =?us-ascii?Q?acDLU6eTpp1IaxxicawGWOdUSP68YTmgFUtmgSIvzqvxGkaNWoWX6nnRDfxp?= =?us-ascii?Q?IZhZkK7WpUt1AHIOMNCwo7F2HgItMEh8dS9ph1zJnvUBorvZqJpI6bxct61X?= =?us-ascii?Q?moEALas1qwUbETtvFnFPvx19+vONKdjq0Qs0FWZr+t3AxxAQ9BSoym9Aa5+s?= =?us-ascii?Q?ygSO70WeXmJ+Vf18Gkuucx3shlh96nMTBe5I4ySE0LJtawH9mBHv/FrzqHtC?= =?us-ascii?Q?l3cMW40t0eQLR59SiZyAC/evV8ZI4e8yvxb35DVFZHIjZK49T5d2NUTBFogc?= =?us-ascii?Q?oHEmSRvd+9EQ2Q6J0sy3Gyh+7QlRztMI0KFl5QK221N7FHtOV/7uvJH4sHfy?= =?us-ascii?Q?IrBkFliGSkU8Pzj6BYqJ40665ozaE9Z4azx78m1etDdTGJrVjo+MHUEbAsPF?= =?us-ascii?Q?k+AWUjEWefn6RtCh3ZM9FriR0OWz4WtyIAWsmGcyz9qc2XVBDjTB8mmeQ2M0?= =?us-ascii?Q?pNSG/M9+Udw+pB85a6s0yAEgZqV6+R0Y0m1N+PjQIWblq1euz1uLy1X91rLd?= =?us-ascii?Q?KxkDz9/H1k2Wob9+D8IdLSAwZvx88d5Xj4S7cJFQGB4pedouRXm2RKibJyqL?= =?us-ascii?Q?ZQ4OnIulLN761180Cg1dA0g1BzWq9YvEGKVDfYrEjvxUQKVCze0T4tHoc32j?= =?us-ascii?Q?PqNi3nLCSuvRPjl+PWXKVcPRN3PShRAAqcPGqtDgPNkG5h0bvBGjkldiOIvr?= =?us-ascii?Q?4xcT7HQM5FU9zUtf3nEC377fOfAT4dxypULLoQ5GhNYTxgzCYzhFmkjt3dbm?= =?us-ascii?Q?CcFJSItBvpoIIKDcV1OcnUnrcfcMgbwi+ks9O6dHxrF4ilIIYKCgXR+wPxAy?= =?us-ascii?Q?iLdW96eZCdQHsBzvUUW3KTSK3I6R2VYxA7Dy/+OIaKdb2iLdRzx4g94xreQr?= =?us-ascii?Q?TNgQVv2V7x6hRSVpCoerXSSA5dUI9YuczPPQgpfM+IRC4ponlAYWy8q325/6?= =?us-ascii?Q?WrXJhl27qrMrNdeSg0lY0pU+FwipmHtdTpJOxT0yIvvEHqFNAJp8/t+fVdxy?= =?us-ascii?Q?WG6oP/MJq0h/bVx3lFK2ZdMfl7Qx9SreDcwtECh3e9dGPzLs2ujICJGq+IV0?= =?us-ascii?Q?FJ97jhv5uirDrrU=3D?= X-Forefront-Antispam-Report: CIP:211.75.126.7;CTRY:TW;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:NTHCCAS01.nuvoton.com;PTR:211-75-126-7.hinet-ip.hinet.net;CAT:NONE;SFS:(13230040)(35950700016)(48200799018)(82310400026)(7093399012)(7416014)(376014)(61400799027)(921020)(35450700002);DIR:OUT;SFP:1022; X-OriginatorOrg: nuvoton.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2024 19:10:46.7976 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f40bfa0f-03f2-431a-e511-08dcd35e9b80 X-MS-Exchange-CrossTenant-Id: a3f24931-d403-4b4a-94f1-7d83ac638e07 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a3f24931-d403-4b4a-94f1-7d83ac638e07;Ip=[211.75.126.7];Helo=[NTHCCAS01.nuvoton.com] X-MS-Exchange-CrossTenant-AuthSource: SG1PEPF000082E1.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR03MB7738 Content-Type: text/plain; charset="utf-8" Add auxiliary driver to support Nuvoton Arbel BMC NPCM8XX contains an integrated clock controller which generates and supplies clocks to all modules within the BMC. The NPCM8xx clock controller is created using the auxiliary device framework and set up in the npcm reset driver since the NPCM8xx clock is using the same register region. Signed-off-by: Tomer Maimon Tested-by: Benjamin Fair Reviewed-by: Stephen Boyd --- drivers/clk/Kconfig | 8 + drivers/clk/Makefile | 1 + drivers/clk/clk-npcm8xx.c | 430 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 439 insertions(+) create mode 100644 drivers/clk/clk-npcm8xx.c diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 983ef4f36d8c..335cd2ede139 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -334,6 +334,14 @@ config COMMON_CLK_LOCHNAGAR This driver supports the clocking features of the Cirrus Logic Lochnagar audio development board. =20 +config COMMON_CLK_NPCM8XX + tristate "Clock driver for the NPCM8XX SoC Family" + depends on ARCH_NPCM || COMPILE_TEST + help + This driver supports the clocks on the Nuvoton BMC NPCM8XX SoC Family, + all the clocks are initialized by the bootloader, so this driver + allows only reading of current settings directly from the hardware. + config COMMON_CLK_LOONGSON2 bool "Clock driver for Loongson-2 SoC" depends on LOONGARCH || COMPILE_TEST diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index f793a16cad40..b8367b47d2b8 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_ARCH_MILBEAUT_M10V) +=3D clk-milbeaut.o obj-$(CONFIG_ARCH_MOXART) +=3D clk-moxart.o obj-$(CONFIG_ARCH_NOMADIK) +=3D clk-nomadik.o obj-$(CONFIG_ARCH_NPCM7XX) +=3D clk-npcm7xx.o +obj-$(CONFIG_COMMON_CLK_NPCM8XX) +=3D clk-npcm8xx.o obj-$(CONFIG_ARCH_NSPIRE) +=3D clk-nspire.o obj-$(CONFIG_COMMON_CLK_PALMAS) +=3D clk-palmas.o obj-$(CONFIG_CLK_LS1028A_PLLDIG) +=3D clk-plldig.o diff --git a/drivers/clk/clk-npcm8xx.c b/drivers/clk/clk-npcm8xx.c new file mode 100644 index 000000000000..2138c011411d --- /dev/null +++ b/drivers/clk/clk-npcm8xx.c @@ -0,0 +1,430 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Nuvoton NPCM8xx Clock Generator + * All the clocks are initialized by the bootloader, so this driver allows= only + * reading of current settings directly from the hardware. + * + * Copyright (C) 2020 Nuvoton Technologies + * Author: Tomer Maimon + */ + +#define pr_fmt(fmt) "npcm8xx_clk: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/* npcm8xx clock registers*/ +#define NPCM8XX_CLKSEL 0x04 +#define NPCM8XX_CLKDIV1 0x08 +#define NPCM8XX_CLKDIV2 0x2C +#define NPCM8XX_CLKDIV3 0x58 +#define NPCM8XX_CLKDIV4 0x7C +#define NPCM8XX_PLLCON0 0x0C +#define NPCM8XX_PLLCON1 0x10 +#define NPCM8XX_PLLCON2 0x54 +#define NPCM8XX_PLLCONG 0x60 +#define NPCM8XX_THRTL_CNT 0xC0 + +#define PLLCON_LOKI BIT(31) +#define PLLCON_LOKS BIT(30) +#define PLLCON_FBDV GENMASK(27, 16) +#define PLLCON_OTDV2 GENMASK(15, 13) +#define PLLCON_PWDEN BIT(12) +#define PLLCON_OTDV1 GENMASK(10, 8) +#define PLLCON_INDV GENMASK(5, 0) + +static void __iomem *clk_base; + +struct npcm8xx_clk_pll { + void __iomem *pllcon; + unsigned int id; + const char *name; + unsigned long flags; + struct clk_hw hw; +}; + +#define to_npcm8xx_clk_pll(_hw) container_of(_hw, struct npcm8xx_clk_pll, = hw) + +struct npcm8xx_clk_pll_data { + const char *name; + struct clk_parent_data parent; + unsigned int reg; + unsigned long flags; + struct clk_hw hw; +}; + +struct npcm8xx_clk_div_data { + u32 reg; + u8 shift; + u8 width; + const char *name; + const struct clk_hw *parent_hw; + unsigned long clk_divider_flags; + unsigned long flags; + int onecell_idx; + struct clk_hw hw; +}; + +struct npcm8xx_clk_mux_data { + u8 shift; + u32 mask; + const u32 *table; + const char *name; + const struct clk_parent_data *parent_data; + u8 num_parents; + unsigned long flags; + struct clk_hw hw; +}; + +static struct clk_hw hw_pll1_div2, hw_pll2_div2, hw_gfx_div2, hw_pre_clk; +static struct npcm8xx_clk_pll_data npcm8xx_pll_clks[] =3D { + { "pll0", { .index =3D 0 }, NPCM8XX_PLLCON0, 0 }, + { "pll1", { .index =3D 0 }, NPCM8XX_PLLCON1, 0 }, + { "pll2", { .index =3D 0 }, NPCM8XX_PLLCON2, 0 }, + { "pll_gfx", { .index =3D 0 }, NPCM8XX_PLLCONG, 0 }, +}; + +static const u32 cpuck_mux_table[] =3D { 0, 1, 2, 7 }; +static const struct clk_parent_data cpuck_mux_parents[] =3D { + { .hw =3D &npcm8xx_pll_clks[0].hw }, + { .hw =3D &npcm8xx_pll_clks[1].hw }, + { .index =3D 0 }, + { .hw =3D &npcm8xx_pll_clks[2].hw } +}; + +static const u32 pixcksel_mux_table[] =3D { 0, 2 }; +static const struct clk_parent_data pixcksel_mux_parents[] =3D { + { .hw =3D &npcm8xx_pll_clks[3].hw }, + { .index =3D 0 } +}; + +static const u32 default_mux_table[] =3D { 0, 1, 2, 3 }; +static const struct clk_parent_data default_mux_parents[] =3D { + { .hw =3D &npcm8xx_pll_clks[0].hw }, + { .hw =3D &npcm8xx_pll_clks[1].hw }, + { .index =3D 0 }, + { .hw =3D &hw_pll2_div2 } +}; + +static const u32 sucksel_mux_table[] =3D { 2, 3 }; +static const struct clk_parent_data sucksel_mux_parents[] =3D { + { .index =3D 0 }, + { .hw =3D &hw_pll2_div2 } +}; + +static const u32 mccksel_mux_table[] =3D { 0, 2 }; +static const struct clk_parent_data mccksel_mux_parents[] =3D { + { .hw =3D &hw_pll1_div2 }, + { .index =3D 0 } +}; + +static const u32 clkoutsel_mux_table[] =3D { 0, 1, 2, 3, 4 }; +static const struct clk_parent_data clkoutsel_mux_parents[] =3D { + { .hw =3D &npcm8xx_pll_clks[0].hw }, + { .hw =3D &npcm8xx_pll_clks[1].hw }, + { .index =3D 0 }, + { .hw =3D &hw_gfx_div2 }, + { .hw =3D &hw_pll2_div2 } +}; + +static const u32 gfxmsel_mux_table[] =3D { 2, 3 }; +static const struct clk_parent_data gfxmsel_mux_parents[] =3D { + { .index =3D 0 }, + { .hw =3D &npcm8xx_pll_clks[2].hw } +}; + +static const u32 dvcssel_mux_table[] =3D { 2, 3 }; +static const struct clk_parent_data dvcssel_mux_parents[] =3D { + { .index =3D 0 }, + { .hw =3D &npcm8xx_pll_clks[2].hw } +}; + +static const u32 default3_mux_table[] =3D { 0, 1, 2 }; +static const struct clk_parent_data default3_mux_parents[] =3D { + { .hw =3D &npcm8xx_pll_clks[0].hw }, + { .hw =3D &npcm8xx_pll_clks[1].hw }, + { .index =3D 0 } +}; + +static struct npcm8xx_clk_mux_data npcm8xx_muxes[] =3D { + { 0, 3, cpuck_mux_table, "cpu_mux", cpuck_mux_parents, + ARRAY_SIZE(cpuck_mux_parents), CLK_IS_CRITICAL }, + { 4, 2, pixcksel_mux_table, "gfx_pixel_mux", pixcksel_mux_parents, + ARRAY_SIZE(pixcksel_mux_parents), 0 }, + { 6, 2, default_mux_table, "sd_mux", default_mux_parents, + ARRAY_SIZE(default_mux_parents), 0 }, + { 8, 2, default_mux_table, "uart_mux", default_mux_parents, + ARRAY_SIZE(default_mux_parents), 0 }, + { 10, 2, sucksel_mux_table, "serial_usb_mux", sucksel_mux_parents, + ARRAY_SIZE(sucksel_mux_parents), 0 }, + { 12, 2, mccksel_mux_table, "mc_mux", mccksel_mux_parents, + ARRAY_SIZE(mccksel_mux_parents), 0 }, + { 14, 2, default_mux_table, "adc_mux", default_mux_parents, + ARRAY_SIZE(default_mux_parents), 0 }, + { 16, 2, default_mux_table, "gfx_mux", default_mux_parents, + ARRAY_SIZE(default_mux_parents), 0 }, + { 18, 3, clkoutsel_mux_table, "clkout_mux", clkoutsel_mux_parents, + ARRAY_SIZE(clkoutsel_mux_parents), 0 }, + { 21, 2, gfxmsel_mux_table, "gfxm_mux", gfxmsel_mux_parents, + ARRAY_SIZE(gfxmsel_mux_parents), 0 }, + { 23, 2, dvcssel_mux_table, "dvc_mux", dvcssel_mux_parents, + ARRAY_SIZE(dvcssel_mux_parents), 0 }, + { 25, 2, default3_mux_table, "rg_mux", default3_mux_parents, + ARRAY_SIZE(default3_mux_parents), 0 }, + { 27, 2, default3_mux_table, "rcp_mux", default3_mux_parents, + ARRAY_SIZE(default3_mux_parents), 0 }, +}; + +/* configurable pre dividers: */ +static struct npcm8xx_clk_div_data npcm8xx_pre_divs[] =3D { + { NPCM8XX_CLKDIV1, 21, 5, "pre_adc", &npcm8xx_muxes[6].hw, CLK_DIVIDER_RE= AD_ONLY, 0, -1 }, + { NPCM8XX_CLKDIV1, 26, 2, "ahb", &hw_pre_clk, CLK_DIVIDER_READ_ONLY, CLK_= IS_CRITICAL, NPCM8XX_CLK_AHB }, +}; + +/* configurable dividers: */ +static struct npcm8xx_clk_div_data npcm8xx_divs[] =3D { + { NPCM8XX_CLKDIV1, 28, 3, "adc", &npcm8xx_pre_divs[0].hw, CLK_DIVIDER_REA= D_ONLY | CLK_DIVIDER_POWER_OF_TWO, 0, NPCM8XX_CLK_ADC }, + { NPCM8XX_CLKDIV1, 16, 5, "uart", &npcm8xx_muxes[3].hw, 0, 0, NPCM8XX_CLK= _UART }, + { NPCM8XX_CLKDIV1, 11, 5, "mmc", &npcm8xx_muxes[2].hw, CLK_DIVIDER_READ_O= NLY, 0, NPCM8XX_CLK_MMC }, + { NPCM8XX_CLKDIV1, 6, 5, "spi3", &npcm8xx_pre_divs[1].hw, 0, 0, NPCM8XX_C= LK_SPI3 }, + { NPCM8XX_CLKDIV1, 2, 4, "pci", &npcm8xx_muxes[7].hw, CLK_DIVIDER_READ_ON= LY, 0, NPCM8XX_CLK_PCI }, + + { NPCM8XX_CLKDIV2, 30, 2, "apb4", &npcm8xx_pre_divs[1].hw, CLK_DIVIDER_RE= AD_ONLY | CLK_DIVIDER_POWER_OF_TWO, 0, NPCM8XX_CLK_APB4 }, + { NPCM8XX_CLKDIV2, 28, 2, "apb3", &npcm8xx_pre_divs[1].hw, CLK_DIVIDER_RE= AD_ONLY | CLK_DIVIDER_POWER_OF_TWO, 0, NPCM8XX_CLK_APB3 }, + { NPCM8XX_CLKDIV2, 26, 2, "apb2", &npcm8xx_pre_divs[1].hw, CLK_DIVIDER_RE= AD_ONLY | CLK_DIVIDER_POWER_OF_TWO, 0, NPCM8XX_CLK_APB2 }, + { NPCM8XX_CLKDIV2, 24, 2, "apb1", &npcm8xx_pre_divs[1].hw, CLK_DIVIDER_RE= AD_ONLY | CLK_DIVIDER_POWER_OF_TWO, 0, NPCM8XX_CLK_APB1 }, + { NPCM8XX_CLKDIV2, 22, 2, "apb5", &npcm8xx_pre_divs[1].hw, CLK_DIVIDER_RE= AD_ONLY | CLK_DIVIDER_POWER_OF_TWO, 0, NPCM8XX_CLK_APB5 }, + { NPCM8XX_CLKDIV2, 16, 5, "clkout", &npcm8xx_muxes[8].hw, CLK_DIVIDER_REA= D_ONLY, 0, NPCM8XX_CLK_CLKOUT }, + { NPCM8XX_CLKDIV2, 13, 3, "gfx", &npcm8xx_muxes[7].hw, CLK_DIVIDER_READ_O= NLY, 0, NPCM8XX_CLK_GFX }, + { NPCM8XX_CLKDIV2, 8, 5, "usb_bridge", &npcm8xx_muxes[4].hw, CLK_DIVIDER_= READ_ONLY, 0, NPCM8XX_CLK_SU }, + { NPCM8XX_CLKDIV2, 4, 4, "usb_host", &npcm8xx_muxes[4].hw, CLK_DIVIDER_RE= AD_ONLY, 0, NPCM8XX_CLK_SU48 }, + { NPCM8XX_CLKDIV2, 0, 4, "sdhc", &npcm8xx_muxes[2].hw, CLK_DIVIDER_READ_O= NLY, 0, NPCM8XX_CLK_SDHC }, + + { NPCM8XX_CLKDIV3, 16, 8, "spi1", &npcm8xx_pre_divs[1].hw, CLK_DIVIDER_RE= AD_ONLY, 0, NPCM8XX_CLK_SPI1 }, + { NPCM8XX_CLKDIV3, 11, 5, "uart2", &npcm8xx_muxes[3].hw, CLK_DIVIDER_READ= _ONLY, 0, NPCM8XX_CLK_UART2 }, + { NPCM8XX_CLKDIV3, 6, 5, "spi0", &npcm8xx_pre_divs[1].hw, CLK_DIVIDER_REA= D_ONLY, 0, NPCM8XX_CLK_SPI0 }, + { NPCM8XX_CLKDIV3, 1, 5, "spix", &npcm8xx_pre_divs[1].hw, CLK_DIVIDER_REA= D_ONLY, 0, NPCM8XX_CLK_SPIX }, + + { NPCM8XX_CLKDIV4, 28, 4, "rg", &npcm8xx_muxes[11].hw, CLK_DIVIDER_READ_O= NLY, 0, NPCM8XX_CLK_RG }, + { NPCM8XX_CLKDIV4, 12, 4, "rcp", &npcm8xx_muxes[12].hw, CLK_DIVIDER_READ_= ONLY, 0, NPCM8XX_CLK_RCP }, + + { NPCM8XX_THRTL_CNT, 0, 2, "th", &npcm8xx_muxes[0].hw, CLK_DIVIDER_READ_O= NLY | CLK_DIVIDER_POWER_OF_TWO, 0, NPCM8XX_CLK_TH }, +}; + +static unsigned long npcm8xx_clk_pll_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct npcm8xx_clk_pll *pll =3D to_npcm8xx_clk_pll(hw); + unsigned long fbdv, indv, otdv1, otdv2; + unsigned int val; + u64 ret; + + if (parent_rate =3D=3D 0) { + pr_debug("%s: parent rate is zero\n", __func__); + return 0; + } + + val =3D readl_relaxed(pll->pllcon); + + indv =3D FIELD_GET(PLLCON_INDV, val); + fbdv =3D FIELD_GET(PLLCON_FBDV, val); + otdv1 =3D FIELD_GET(PLLCON_OTDV1, val); + otdv2 =3D FIELD_GET(PLLCON_OTDV2, val); + + ret =3D (u64)parent_rate * fbdv; + do_div(ret, indv * otdv1 * otdv2); + + return ret; +} + +static const struct clk_ops npcm8xx_clk_pll_ops =3D { + .recalc_rate =3D npcm8xx_clk_pll_recalc_rate, +}; + +static struct clk_hw * +npcm8xx_clk_register_pll(struct device *dev, void __iomem *pllcon, + const char *name, const struct clk_parent_data *parent, + unsigned long flags) +{ + struct npcm8xx_clk_pll *pll; + struct clk_init_data init =3D {}; + int ret; + + pll =3D devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); + if (!pll) + return ERR_PTR(-ENOMEM); + + init.name =3D name; + init.ops =3D &npcm8xx_clk_pll_ops; + init.parent_data =3D parent; + init.num_parents =3D 1; + init.flags =3D flags; + + pll->pllcon =3D pllcon; + pll->hw.init =3D &init; + + ret =3D devm_clk_hw_register(dev, &pll->hw); + if (ret) + return ERR_PTR(ret); + + return &pll->hw; +} + +static DEFINE_SPINLOCK(npcm8xx_clk_lock); + +static int npcm8xx_clk_probe(struct auxiliary_device *adev, + const struct auxiliary_device_id *id) +{ + struct npcm_clock_adev *rdev =3D to_npcm_clock_adev(adev); + struct clk_hw_onecell_data *npcm8xx_clk_data; + struct device *dev =3D &adev->dev; + struct clk_hw *hw; + unsigned int i; + + npcm8xx_clk_data =3D devm_kzalloc(dev, struct_size(npcm8xx_clk_data, hws, + NPCM8XX_NUM_CLOCKS), + GFP_KERNEL); + if (!npcm8xx_clk_data) + return -ENOMEM; + + clk_base =3D rdev->base; + + npcm8xx_clk_data->num =3D NPCM8XX_NUM_CLOCKS; + + for (i =3D 0; i < NPCM8XX_NUM_CLOCKS; i++) + npcm8xx_clk_data->hws[i] =3D ERR_PTR(-EPROBE_DEFER); + + /* Register plls */ + for (i =3D 0; i < ARRAY_SIZE(npcm8xx_pll_clks); i++) { + struct npcm8xx_clk_pll_data *pll_clk =3D &npcm8xx_pll_clks[i]; + + hw =3D npcm8xx_clk_register_pll(dev, clk_base + pll_clk->reg, + pll_clk->name, &pll_clk->parent, + pll_clk->flags); + if (IS_ERR(hw)) + return dev_err_probe(dev, PTR_ERR(hw), "Can't register pll\n"); + pll_clk->hw =3D *hw; + } + + /* Register fixed dividers */ + hw =3D devm_clk_hw_register_fixed_factor(dev, "pll1_div2", "pll1", 0, 1, = 2); + if (IS_ERR(hw)) + return dev_err_probe(dev, PTR_ERR(hw), "Can't register fixed div\n"); + hw_pll1_div2 =3D *hw; + + hw =3D devm_clk_hw_register_fixed_factor(dev, "pll2_div2", "pll2", 0, 1, = 2); + if (IS_ERR(hw)) + return dev_err_probe(dev, PTR_ERR(hw), "Can't register pll2 div2\n"); + hw_pll2_div2 =3D *hw; + + hw =3D devm_clk_hw_register_fixed_factor(dev, "pll_gfx_div2", "pll_gfx", = 0, 1, 2); + if (IS_ERR(hw)) + return dev_err_probe(dev, PTR_ERR(hw), "Can't register gfx div2\n"); + hw_gfx_div2 =3D *hw; + + /* Register muxes */ + for (i =3D 0; i < ARRAY_SIZE(npcm8xx_muxes); i++) { + struct npcm8xx_clk_mux_data *mux_data =3D &npcm8xx_muxes[i]; + + hw =3D devm_clk_hw_register_mux_parent_data_table(dev, + mux_data->name, + mux_data->parent_data, + mux_data->num_parents, + mux_data->flags, + clk_base + NPCM8XX_CLKSEL, + mux_data->shift, + mux_data->mask, + 0, + mux_data->table, + &npcm8xx_clk_lock); + if (IS_ERR(hw)) + return dev_err_probe(dev, PTR_ERR(hw), "Can't register mux\n"); + mux_data->hw =3D *hw; + } + + hw =3D devm_clk_hw_register_fixed_factor(dev, "pre_clk", "cpu_mux", 0, 1,= 2); + if (IS_ERR(hw)) + return dev_err_probe(dev, PTR_ERR(hw), "Can't register pre clk div2\n"); + hw_pre_clk =3D *hw; + + hw =3D devm_clk_hw_register_fixed_factor(dev, "axi", "th", 0, 1, 2); + if (IS_ERR(hw)) + return dev_err_probe(dev, PTR_ERR(hw), "Can't register axi div2\n"); + npcm8xx_clk_data->hws[NPCM8XX_CLK_AXI] =3D hw; + + hw =3D devm_clk_hw_register_fixed_factor(dev, "atb", "axi", 0, 1, 2); + if (IS_ERR(hw)) + return dev_err_probe(dev, PTR_ERR(hw), "Can't register atb div2\n"); + npcm8xx_clk_data->hws[NPCM8XX_CLK_ATB] =3D hw; + + /* Register pre dividers */ + for (i =3D 0; i < ARRAY_SIZE(npcm8xx_pre_divs); i++) { + struct npcm8xx_clk_div_data *div_data =3D &npcm8xx_pre_divs[i]; + + hw =3D devm_clk_hw_register_divider_parent_hw(dev, div_data->name, + div_data->parent_hw, + div_data->flags, + clk_base + div_data->reg, + div_data->shift, + div_data->width, + div_data->clk_divider_flags, + &npcm8xx_clk_lock); + if (IS_ERR(hw)) + return dev_err_probe(dev, PTR_ERR(hw), "Can't register pre div\n"); + div_data->hw =3D *hw; + + if (div_data->onecell_idx >=3D 0) + npcm8xx_clk_data->hws[div_data->onecell_idx] =3D hw; + } + + /* Register dividers */ + for (i =3D 0; i < ARRAY_SIZE(npcm8xx_divs); i++) { + struct npcm8xx_clk_div_data *div_data =3D &npcm8xx_divs[i]; + + hw =3D devm_clk_hw_register_divider_parent_hw(dev, div_data->name, + div_data->parent_hw, + div_data->flags, + clk_base + div_data->reg, + div_data->shift, + div_data->width, + div_data->clk_divider_flags, + &npcm8xx_clk_lock); + if (IS_ERR(hw)) + return dev_err_probe(dev, PTR_ERR(hw), "Can't register div\n"); + + if (div_data->onecell_idx >=3D 0) + npcm8xx_clk_data->hws[div_data->onecell_idx] =3D hw; + } + + return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, + npcm8xx_clk_data); +} + +static const struct auxiliary_device_id npcm8xx_clock_ids[] =3D { + { + .name =3D "reset_npcm.clk-npcm8xx", + }, + { } +}; +MODULE_DEVICE_TABLE(auxiliary, npcm8xx_clock_ids); + +static struct auxiliary_driver npcm8xx_clock_driver =3D { + .probe =3D npcm8xx_clk_probe, + .id_table =3D npcm8xx_clock_ids, +}; +module_auxiliary_driver(npcm8xx_clock_driver); + +MODULE_DESCRIPTION("Clock driver for Nuvoton NPCM8XX BMC SoC"); +MODULE_AUTHOR("Tomer Maimon "); +MODULE_LICENSE("GPL v2"); + --=20 2.34.1