From patchwork Fri Jan 26 07:09:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13532148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35E5AC47422 for ; Fri, 26 Jan 2024 07:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=AwDgkQFO8BFh1ZpZzjvUMZaSKhEsaKSK/eDIF5htN2E=; b=XL+QowYorqe6468/DPY//jteSW 9Kkqsd8NaTqSw3VQ241ddTDJPUrTqgXozD65v/wO0/5LB8bplTJkpvhqY6cxnFltTWiiE0IrlbWTG scvKKlA7s8R8E3KDDgortQE96Bvta/2/a69LL/j0vXfUnhbRxosJi/BEX5adbd3wsSPKCIpLmVJhy O3MWymDkoY521Yzd47a5hhbeO3ovpFi1mCA0ZFofFZKt65CjFCXx3wuPWjBKRYcFylcVigC5oVnot BokQFMcN8E016Wa8CJAmj+VrWhca9qqc54Eue2fG/qaGCkOtT9qA75vHBGI+Xcy2loQTzYLsV546p kBZ8kYpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTGHO-00000003J2b-1OTv; Fri, 26 Jan 2024 07:05:34 +0000 Received: from mail-vi1eur04on2043.outbound.protection.outlook.com ([40.107.8.43] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTGHE-00000003IxL-0iT6 for linux-arm-kernel@lists.infradead.org; Fri, 26 Jan 2024 07:05:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AFUyLOZLsTrT/2B6uGeRipQtFzdk0YcVIgPdvIAmgnb6rZKa9LYxemJUzPQrj2/n41qMzKnWKZUXFKKTKtgZd0mxVwInvRJtOB6GqwOAiJAfiGrVbLq8kVBWCBtRCthgkKFJDa0u/KpKEK9gAe4NiJlTLYqizndr7kwz7jVlp8XuNJBkhowPmXh3F4OeKr7iuWl6ewA7ENtASapHQVWeOWMafYIUrwykn3ljbHi4tm23tqMRS8VLr64d8u1bzKwmIGXaBMDymtq9U5BmhatL9zzp+PS8i22/1Nx8sg6irf2e4etIVWIhuHQlgQZk+BHJzxD4a/vCzQcVfK7x4gIyVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QG/hXtUzmakq+m1jt1j14ll0N4okk88EMn++WGWtT5A=; b=Xob8vMR9F6htIx8h1MmuB/8UXg7VP9vJqI6BXmIpxVHwwtCiD4ONpfm6c8mU1XvBEH5zAl3GtThez2h7plvR6AJvs+vctjt+gBMbmFMHKAp0dz/J4aNp67jMa6S6CshHTmtZSDlGhtaom26kxafOhLzyNep7PvmfWtb2yZN+4c5lN5Gycj0eMdqbd13Hq1fCqsTX5Acb2AaWBobYvlu1zUOi+tGc0XMB1Lf+rldcM/JIhWMhV3oHLmRfeR4eerqI7i9iba0V40AdtFeUA86OwLc+aW5gU2WBpSZoWkc1jc/26q4s0KVyO1pBvsIO38uEiDbyPHMNGbRCdkcdtZUYOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QG/hXtUzmakq+m1jt1j14ll0N4okk88EMn++WGWtT5A=; b=NAq0/Rnha3iu6kZDEimzlXjOnEgeZCf4j5X9Qu4EHJlfQUYlemDVFv63G7SvCVQVBiD1PKTnjfL0q+AA4sMDW5ywczBc2X+Umf6DPVOH41hmRozca7/HWOz1bQpOTjYSAO24HBTG/8ZnFy9P+eZhsY5tpccsc1CeT7rZ2ptLSVU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AS5PR04MB9825.eurprd04.prod.outlook.com (2603:10a6:20b:672::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.27; Fri, 26 Jan 2024 07:05:05 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::c499:8cef:9bb1:ced6]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::c499:8cef:9bb1:ced6%3]) with mapi id 15.20.7228.022; Fri, 26 Jan 2024 07:05:05 +0000 From: "Peng Fan (OSS)" Date: Fri, 26 Jan 2024 15:09:18 +0800 Subject: [PATCH v3 1/3] dt-bindings: timer: nxp,sysctr-timer: support i.MX95 Message-Id: <20240126-imx-sysctr-v3-1-33fe801d5f31@nxp.com> References: <20240126-imx-sysctr-v3-0-33fe801d5f31@nxp.com> In-Reply-To: <20240126-imx-sysctr-v3-0-33fe801d5f31@nxp.com> To: Daniel Lezcano , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bai Ping , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Marco Felsch Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706252968; l=866; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=cjsWYdjBFkj2DyyNJGJXUMOsSan0x/ZKOMQwVw8ko2k=; b=9Nt3ufd4JfgFOa6yva/dce7Dcx54UqwgAHnpFamv0IF5CugTuyrthuYRLruYDrefptYkL1/5g SjYQB4juvEyBQdsJq1301dke46BWbeFtpw3YFE4VtqbTCts/m3x3eu5 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR04CA0002.apcprd04.prod.outlook.com (2603:1096:4:197::17) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|AS5PR04MB9825:EE_ X-MS-Office365-Filtering-Correlation-Id: 95a3c580-906a-441b-7951-08dc1e3d1f6e X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0ne+fdbHVICA2kPdVMQHW5AwqdwDWcjDXIrOiFHDjPMhS4Y7F1Tpoijw0VgNuSQFqrbaCj08iFxECHR7IXtJWFO3FQAjkQO4gUSQs3PMVzWRHi3vNS/uHXvYMIkNZzbehjckZPaSIl/S2f2VOPmN5VN67wE0Zdy2fXLp9itkOegIMkZcUr17kSBTlObjUIOJy20W9eNoq2i1SchzOd9EZ6oCrCQQq4cMyxGDvhztW2RgHa0zWlB/zPxjJ53iSXQJ+rctZaicfUOYIa4PETQpGdrZaFvB/yBzXZq3wwAxKQPBgVQ0knD/+NxBgNxmTYAaX2+4PB24xi3X/dLZ4CI3GkXiXEyl6Za5HMo4B0XC9Hl4SB3GzcVc2qx0YyWlh0jcyW/387vRLVBPl3WSxY+F1cZX5cmlUZC6qMUSba4PXInQCZEaFMrHk7xv4kYa0tA+sc72RQzpez1/HwOa5rnaP3SpIoQVnGlLE3/NOFiWK1X9IF8dGgR9YakFv9JU5PzoYMOwlR72lpZFgLgUzJvFZP6MmsaJe/JjwpAheBytppvCHqO89d0k9/qy+oGcGceaMMlBx/OFtQ6d3uksPXFaiwhasjKcdfRNcr4d//5RcTpnyOGyZZHijPV+LynUwOve X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(396003)(346002)(366004)(136003)(39860400002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(83380400001)(921011)(110136005)(36756003)(86362001)(41300700001)(38350700005)(38100700002)(26005)(9686003)(6512007)(6486002)(52116002)(6506007)(4744005)(2906002)(478600001)(66946007)(316002)(6666004)(66476007)(66556008)(5660300002)(8676002)(4326008)(7416002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?PcXQuSpBerypGpJSmhupYXVAqURu?= =?utf-8?q?y9CvvazvZwjzDFOjiekPs6fwxv4S3NzyWmgs9NI6x+LN+C2qMpZJd1qFD6BDJUc25?= =?utf-8?q?BvYF2BZtOPD9db93gAsEUVwlV+5NOkYX+7vZ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+3bZtoztdO8T3bfOaKJ?= =?utf-8?q?ePL9dQN9o/20WgbAltPB2YN/0iUEunrB0glmUaaXnQB58v57VLBvtXb3ypMnkTpsG?= =?utf-8?q?zqu/UI6s+GZxJMrPHa0BtnKRvSa5gtcw8s8WsARmFubbrHdnGqSkJ1sr4Rl4rMiK/?= =?utf-8?q?lqmhvnCilbd5MvNhZWPRVJzWIN8TAknpRnQlWEAS5FlcYHeWJBrZUh28Bt9j6xBRg?= =?utf-8?q?9xFkFD4kjwY8ypojlj3QlfjcgFuG2OAxTMcWd+nmHmbXjq8CYYv4v9tdxkwEpo34c?= =?utf-8?q?tcocwSQJWerTtoN3Iw2q2NIH+XTt9XrJoyCSQLStLL4xibTKJozSnDjOZj6pqPsft?= =?utf-8?q?/C2XGaTkF4G78PD7guQb8/4BejOe7uWBy5BhWsmkFELb8Lp6Ghz6tK2eL+SdJko58?= =?utf-8?q?1EJVia3krI3QEH2Uk8HvAPCtYG1TMXB6VVFLSINi5HdPtNoPFl9jhymFKKXjH6Kfq?= =?utf-8?q?GlH0mW8HLw6m27oa/O5LiuXmFs/OiayZXinTGy+9vn61P4/cSGjRh8RaquWk6eISh?= =?utf-8?q?wxmlq4UkZriQ?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95a3c580-906a-441b-7951-08dc1e3d1f6e X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2024 07:05:05.0386 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4hCV0ptX994q4IU9fkIebfeGqXYmJZBKPHmMZmJbPj7HR4Y2bueLF3MMYm5csrhaRwMT0WeDGa4q9HGl+M3XSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB9825 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240125_230524_286053_5100294E X-CRM114-Status: GOOD ( 10.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan Add i.MX95 System counter module compatible string, the SCMI firmware blocks access to control register, so should not add "nxp,sysctr-timer" as fallback. Signed-off-by: Peng Fan Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/timer/nxp,sysctr-timer.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.yaml b/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.yaml index 2b9653dafab8..891cca009528 100644 --- a/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.yaml +++ b/Documentation/devicetree/bindings/timer/nxp,sysctr-timer.yaml @@ -18,7 +18,9 @@ description: | properties: compatible: - const: nxp,sysctr-timer + enum: + - nxp,imx95-sysctr-timer + - nxp,sysctr-timer reg: maxItems: 1 From patchwork Fri Jan 26 07:09:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13532149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96B20C47422 for ; Fri, 26 Jan 2024 07:05:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=W9v7uVxDrhX1Xfeo+Eq/4dQBtG2MQ+MTwcLNq2xUJ78=; b=xlVBFttnNv2Qt7+ut7z4BrZX0h R9cOuM+u+IuDaw97Y0O8K24m/rxy80OtEMqhUv3t9I4i2pdvHi8/4z1s82Qnp00FBwl2be20cK8jv 2RqZ7G67A8JD8z0hHJXTsJZZToYual2IeNu415tPnUZcHdYVtkn3c8R4SFmZaKdAKMYgV3h04DjQ7 DwLDgw9cPnQyxfynyFf2yw0D9eO/Juuy1QBdY1az66Z7Fdbb4L4PjEuECEgq64jkX1SSaksKC2eKk HQLP1p3ui1Qiq6i+rZXYKEpdBw8pmWKECKsP/bF7Fpp2bVjF/EnDD76Fc8w9j9RSaVRXLbpSBx4Qa BVvckLNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTGHN-00000003J2C-2RBZ; Fri, 26 Jan 2024 07:05:33 +0000 Received: from mail-am6eur05on20601.outbound.protection.outlook.com ([2a01:111:f403:2612::601] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTGHC-00000003Iwj-0Hlu for linux-arm-kernel@lists.infradead.org; Fri, 26 Jan 2024 07:05:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ChrQlUShimnV2UfAasZXjH2JrW2LkTVIUbtfJA144ulg3Lzbyr5alHijW8XC2dJq2lAHOvChkiSXA3gFz6ih7BoxLV7MESz26rYR6rV7OQN1IqOClWJLA0m/h2Ehb/b3FH3p+Wuyu8Q2rlI1Im+RCt+l83TPySO7hXgVY3hnqYuxmTYSzh3hZ0hdIQ+Zu1o8PXyOTJmxjy7nmyezVKtHkgipvmDnQQpRZL2m2y0KfE6sM0hNBSWONF7IvN+LbaZhB+VdNvAvfaNW01Wp+lkpeH4y7zp7IdZ12s7q6Xxy+mhJpCNQlbrN9N8oJr3TSexRpLlmeL1V6bkmB4q+5D/XTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GWwGLQogleAHAp03QiCYcNmz77yayBGa4AxJXmlI5Q0=; b=ImYLJUf2BwLRzTncw6BimsuvJYEvFJ9ylcpEKMKdAr+elUe8MbiWU48jSKnWEYwkroeFH05lRHuJVXneVwjHWnm9Zma+0wyq2R6UdOmEUyzBEr8F0pHRD+9/VFfhOeBEo5OqDiYTnMGJ7tsXfK8qWWvro5+TYKw594Yaj6UmR6UXELXp4hG5PWvX8xf/KZU1fwZ4s99O9W6OYrHzG1yl/zl5xHk81q9K/MEqkPvZbBclAhQVXIEJ3nVC83wiAXnwYv781azHDVZ0gycWjXo6cazxDJidet2DupxJYs3qW5nce841McFbzIIa8Dj797Ebi8KLOu4frfMhSi91ebYmWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GWwGLQogleAHAp03QiCYcNmz77yayBGa4AxJXmlI5Q0=; b=TCoWZz5RTxPcnkNv7ZpJcFu55LRky3lUzo5vTCAMN3ZEJ7wJwDpfbVYcgxTI4WYcfOTpjwi7snVAuo4CAx2NL7VB6YyoBTz862ez1Q6T9HWxz50/gqUtTCfsAkCx5GDeRx0UMQQBxhGrfDZxQHplYMrhWwZFOtSuN7xqNVywNZI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DBBPR04MB7515.eurprd04.prod.outlook.com (2603:10a6:10:202::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.27; Fri, 26 Jan 2024 07:05:09 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::c499:8cef:9bb1:ced6]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::c499:8cef:9bb1:ced6%3]) with mapi id 15.20.7228.022; Fri, 26 Jan 2024 07:05:09 +0000 From: "Peng Fan (OSS)" Date: Fri, 26 Jan 2024 15:09:19 +0800 Subject: [PATCH v3 2/3] clocksource/drivers/imx-sysctr: drop use global variables Message-Id: <20240126-imx-sysctr-v3-2-33fe801d5f31@nxp.com> References: <20240126-imx-sysctr-v3-0-33fe801d5f31@nxp.com> In-Reply-To: <20240126-imx-sysctr-v3-0-33fe801d5f31@nxp.com> To: Daniel Lezcano , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bai Ping , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Marco Felsch Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706252968; l=4759; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=GNd7nn9IlMWOE6EtgMoRLuOvy3mCu2EVYjx6qUvMpbo=; b=t0YAXFpShJ+kyGL9+aJ76dTajHOu6B/NgIS6JNiyyk9CXMG97W8VWOXltP2q4yuQwxZ3NJcaY ntUjmwCV0g7AB2AdBsIsEyOS07qnyAE9jJ8HoaknPyS/Pbh+WM71P2J X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR04CA0002.apcprd04.prod.outlook.com (2603:1096:4:197::17) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBBPR04MB7515:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d483ba1-f61e-4dbd-f76e-08dc1e3d2240 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AOj5PFPHUuMTpYjAH4jb8MlJwdxXjcOrbATAS2eTR/+UP33CYraRDOZ8Gs2myOos1UMAlM0wZsVRz1faQGeFPwsxpXZ81OvuY0TG7VRKp44yWd657nzOfrvoSgXp9s86EfIbZOMG+YiNr3BxlzAaBTzDsdBxzexyTQtz/45w++i6S0x3FVKVf8p02XkFhY6Ts8Pf1jxoMdVnjdiigWbuINoQ8ioRBmmfG9xosO2K0iVi6DTHPzmHqs4VnlLugbV5hoj1Be21Ykg1b/L4cnz7ILDCofzplTu3o+vUgFchLm2PFpWAdpZZg5rB0JxWfrCfMMoaADbOcUwOmsVTokEhqrZSDTVaGC8osMVVKnKYUulDIbVeeQ9YaYfaHf2qzVO6BdLFCPueAMjK4rttLwOq/3PA8JYDYhX6RWUVuA2uuYR59mQE1cImaSKJWrh1Dp1h1wWZNQL+W9tvA+lzzJQDy9qffD5dlQZEbak+iHTbuCWg0Eawq+rZDrn67SQT5V0tsv0hKL2dFNd4LFW14ygLip8PMZhN3UvGGEPmwHxLjYzIQOXfimXJGqOI9f7Yw7pwDT2UqKl1B+0OxiQ7UBJMdj+at53wtloMDoSFt2SA13Z2LHtkrbAygRefsSWiO93gDUxX/pf/Ky29H1AfVyBqfg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(39860400002)(346002)(136003)(396003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(7416002)(2906002)(478600001)(5660300002)(4326008)(921011)(38350700005)(8936002)(66946007)(66556008)(316002)(36756003)(66476007)(8676002)(41300700001)(6486002)(110136005)(52116002)(6506007)(6512007)(26005)(9686003)(86362001)(6666004)(83380400001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?syM4gGfGX37qvAauTPkkxc8NLwfv?= =?utf-8?q?u9hPAWdA9sUCM7r3oY4jPqZDEA6q+ASQ+f+si5KYWoxL4fonJuiy7GBEaSCIT2rVs?= =?utf-8?q?VL5r7DQWi71hDNvyQFckgsRx5ksna85TzSpi3AAHmYq1uFGRCfY1VEARKc5CMlFvl?= =?utf-8?q?IfNfJg/cNFwZ/EiB45pt5h94kQITBl/19PwyZGn/xh0eSaPAYr3DW//cfrLjLBg+d?= =?utf-8?q?Q2qGpwBeoXrjEGL2t2+O8FVDQ5R0mJEZtch908JLnffdvJrH03LWV2rwrPpTk0mPt?= =?utf-8?q?78rD1ZBA9JsqpAZmzMHhjzAHlMPTf7Lqw3PV0swJBo7+TdLIRb/2KnI+zf5tp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N8Z/E6NYtswJdD9DDXE?= =?utf-8?q?D4pGlZlh018Cm7CZ0L4JEfpoyHAVUc1sBwSI6BsnA8C7LOjExR15DINOT7o6CYDx8?= =?utf-8?q?KXtYAiQdnzGgqnI8E/xy/dENPr7nSKgLyCZk/kQmkgrZvph+sgJ8kKitDgI1ercll?= =?utf-8?q?LQj1Mevplg5NUqbvlvEf2rurRRnXjYFkI9m6IRJjLnCdIc8mJv1/dpVO58e+3VeZW?= =?utf-8?q?6Le9/AspSbi+zzJrdATKvqOfSf7I/rkcw712BsIr64nAJUkh6LpU0iGIp96r92CL8?= =?utf-8?q?02HzT4xOS/usGPD9+I2gTJ+2jyNp060eAUmB/fzNARdTKntPdmnV0nc/u4643C+K7?= =?utf-8?q?TrfDAkecMIet?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d483ba1-f61e-4dbd-f76e-08dc1e3d2240 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2024 07:05:09.7168 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lwFzY5Y6pLvOM7EmbOReEsFqj+sf3gxXtapxJcFSakT618mOSnw/XhiyGReBB43+3BoF6GOVvdEC41evKS1+SQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7515 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240125_230523_790975_721B3B85 X-CRM114-Status: GOOD ( 18.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan Clean up code to not use global variables and introduce sysctr_private structure to prepare the support for i.MX95. Signed-off-by: Peng Fan --- drivers/clocksource/timer-imx-sysctr.c | 75 +++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c index 5a7a951c4efc..8d5bfb8470fb 100644 --- a/drivers/clocksource/timer-imx-sysctr.c +++ b/drivers/clocksource/timer-imx-sysctr.c @@ -20,32 +20,39 @@ #define SYS_CTR_CLK_DIV 0x3 -static void __iomem *sys_ctr_base __ro_after_init; -static u32 cmpcr __ro_after_init; +struct sysctr_private { + u32 cmpcr; +}; -static void sysctr_timer_enable(bool enable) +static void sysctr_timer_enable(struct clock_event_device *evt, bool enable) { - writel(enable ? cmpcr | SYS_CTR_EN : cmpcr, sys_ctr_base + CMPCR); + struct timer_of *to = to_timer_of(evt); + struct sysctr_private *priv = to->private_data; + void __iomem *base = timer_of_base(to); + + writel(enable ? priv->cmpcr | SYS_CTR_EN : priv->cmpcr, base + CMPCR); } -static void sysctr_irq_acknowledge(void) +static void sysctr_irq_acknowledge(struct clock_event_device *evt) { /* * clear the enable bit(EN =0) will clear * the status bit(ISTAT = 0), then the interrupt * signal will be negated(acknowledged). */ - sysctr_timer_enable(false); + sysctr_timer_enable(evt, false); } -static inline u64 sysctr_read_counter(void) +static inline u64 sysctr_read_counter(struct clock_event_device *evt) { + struct timer_of *to = to_timer_of(evt); + void __iomem *base = timer_of_base(to); u32 cnt_hi, tmp_hi, cnt_lo; do { - cnt_hi = readl_relaxed(sys_ctr_base + CNTCV_HI); - cnt_lo = readl_relaxed(sys_ctr_base + CNTCV_LO); - tmp_hi = readl_relaxed(sys_ctr_base + CNTCV_HI); + cnt_hi = readl_relaxed(base + CNTCV_HI); + cnt_lo = readl_relaxed(base + CNTCV_LO); + tmp_hi = readl_relaxed(base + CNTCV_HI); } while (tmp_hi != cnt_hi); return ((u64) cnt_hi << 32) | cnt_lo; @@ -54,22 +61,24 @@ static inline u64 sysctr_read_counter(void) static int sysctr_set_next_event(unsigned long delta, struct clock_event_device *evt) { + struct timer_of *to = to_timer_of(evt); + void __iomem *base = timer_of_base(to); u32 cmp_hi, cmp_lo; u64 next; - sysctr_timer_enable(false); + sysctr_timer_enable(evt, false); - next = sysctr_read_counter(); + next = sysctr_read_counter(evt); next += delta; cmp_hi = (next >> 32) & 0x00fffff; cmp_lo = next & 0xffffffff; - writel_relaxed(cmp_hi, sys_ctr_base + CMPCV_HI); - writel_relaxed(cmp_lo, sys_ctr_base + CMPCV_LO); + writel_relaxed(cmp_hi, base + CMPCV_HI); + writel_relaxed(cmp_lo, base + CMPCV_LO); - sysctr_timer_enable(true); + sysctr_timer_enable(evt, true); return 0; } @@ -81,7 +90,7 @@ static int sysctr_set_state_oneshot(struct clock_event_device *evt) static int sysctr_set_state_shutdown(struct clock_event_device *evt) { - sysctr_timer_enable(false); + sysctr_timer_enable(evt, false); return 0; } @@ -90,7 +99,7 @@ static irqreturn_t sysctr_timer_interrupt(int irq, void *dev_id) { struct clock_event_device *evt = dev_id; - sysctr_irq_acknowledge(); + sysctr_irq_acknowledge(evt); evt->event_handler(evt); @@ -117,34 +126,36 @@ static struct timer_of to_sysctr = { }, }; -static void __init sysctr_clockevent_init(void) -{ - to_sysctr.clkevt.cpumask = cpu_possible_mask; - - clockevents_config_and_register(&to_sysctr.clkevt, - timer_of_rate(&to_sysctr), - 0xff, 0x7fffffff); -} - static int __init sysctr_timer_init(struct device_node *np) { - int ret = 0; + struct sysctr_private *priv; + void __iomem *base; + int ret; + + priv = kzalloc(sizeof(struct sysctr_private), GFP_KERNEL); + if (!priv) + return -ENOMEM; ret = timer_of_init(np, &to_sysctr); - if (ret) + if (ret) { + kfree(priv); return ret; + } if (!of_property_read_bool(np, "nxp,no-divider")) { /* system counter clock is divided by 3 internally */ to_sysctr.of_clk.rate /= SYS_CTR_CLK_DIV; } - sys_ctr_base = timer_of_base(&to_sysctr); - cmpcr = readl(sys_ctr_base + CMPCR); - cmpcr &= ~SYS_CTR_EN; + to_sysctr.clkevt.cpumask = cpu_possible_mask; + to_sysctr.private_data = priv; - sysctr_clockevent_init(); + base = timer_of_base(&to_sysctr); + priv->cmpcr = readl(base + CMPCR) & ~SYS_CTR_EN; + clockevents_config_and_register(&to_sysctr.clkevt, + timer_of_rate(&to_sysctr), + 0xff, 0x7fffffff); return 0; } TIMER_OF_DECLARE(sysctr_timer, "nxp,sysctr-timer", sysctr_timer_init); From patchwork Fri Jan 26 07:09:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13532150 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0284FC47422 for ; Fri, 26 Jan 2024 07:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=fFzgdnf+tYVGv6d3kV33wPHdsrzdtj7cBauSu+VRxdU=; b=O01NvGMYvxX04rDtsy0d3qQjmO FDFpUJVXw3l+toQ1rYiRLvMJmrF1MJs2T9Wh6PCsyLhSzQFLMYI4vxnGaF9HBHdyWAS8MF2nTWqZZ AL2eKgTEyLScU3x+7gWigeHeteG2J0OV/sxDZHXkrzWDrnM7IHzqZznGDHwvwvPewa/Mf6WZB82lH meYG0DxqSVkoK16xw8RaeQ2Xpk7+TNVgkHvjIosFgIfgzv14nt9rlEA5fptdhGkkDj5zCERCPCLD0 WRS7rzHpDxTvP2Rs+jgPK+Nejjco3PLMV2bQcRkLrxJsKAQgA4nGn22ZygEvA6dnqziHKPJcxUs6P bU0PSoag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTGHP-00000003J3K-1538; Fri, 26 Jan 2024 07:05:35 +0000 Received: from mail-vi1eur04on2043.outbound.protection.outlook.com ([40.107.8.43] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTGHF-00000003IxL-3bKp for linux-arm-kernel@lists.infradead.org; Fri, 26 Jan 2024 07:05:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VEIJKc5wY6E4SRgz/cB7qLbMxmCDHUtGLBoNdLbbGiJC+WP4suRV4S0O7lqzpEh5BwcI2jDWZ6gd0qcVZ5U6ZPJJQbQ0l1x2mkd/7zhLOwRIX7T32XlVI75Bh55CEaznx0w2qzB8+PG7u/wGv6ybSbIQC0X83DttaIQ5Xe1b2yKV0IJO2wEq+ELIj5KXlEMLqd3Ewis5ETP9cpd+/m0ogD6SmIb9uzSewe0bfnjInAj30DMaNQmZec4o+XxLp9wZsis0B3SNM5Ap+cmBJycP02oFynMWotbsOHmzNQ27NFBOOs0LYYgolpY1qiVgvvSn4rRspzue/7mC17qCswRTsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F1lUtjwppp5r6I2j8GSA70ZjQecm5QrSH07ZZ+SCFs0=; b=KU21YPkdVIaFRuaw5peeMLWs0q33erqA0BfpqyQUMtm1AMgvIcGl8BW0vPwJXaUZnqNBJckedYZFRzrft7U6ugKDtY9NKULyRZZ/p6+/8C+B5VCPeyh7Hf2DgdC9nANPczKJJObGlGp+bQgrFXVqa4mDVx1PyzigzQgNC8Lu5XVj6iRyxIsJPIQS0s3XNv+Kqpjw/H1eJr1MeA0G2+XGWYna+DPeHHMwlfONuzlQoqsEZsqgX75KzNwkFMg1dtskC6UW3wYqih+RT4VcpKV2fDQOC2namgR1vd4M5FyFa19QTcznWmpcQVDMMk8KpPjQuQJgwULVMfCif4dXSZz1ZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F1lUtjwppp5r6I2j8GSA70ZjQecm5QrSH07ZZ+SCFs0=; b=Wpj1Td0ma9NHtMDG40kIpY0GhjSbj5eXS/Ob/L7165PkNJQwkdn4/W4c2RW7ioV5LQSNAHnOuskmxqx2gJNd4xcKX5reTQ34e2ZPqcD6jcgbP0iBZs+SQNgfRssEu0dys6Sgw2iJoYkbP//aRzcgSllMdWyzdNmWANPTh3xz76g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AS5PR04MB9825.eurprd04.prod.outlook.com (2603:10a6:20b:672::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.27; Fri, 26 Jan 2024 07:05:14 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::c499:8cef:9bb1:ced6]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::c499:8cef:9bb1:ced6%3]) with mapi id 15.20.7228.022; Fri, 26 Jan 2024 07:05:14 +0000 From: "Peng Fan (OSS)" Date: Fri, 26 Jan 2024 15:09:20 +0800 Subject: [PATCH v3 3/3] clocksource/drivers/imx-sysctr: support i.MX95 Message-Id: <20240126-imx-sysctr-v3-3-33fe801d5f31@nxp.com> References: <20240126-imx-sysctr-v3-0-33fe801d5f31@nxp.com> In-Reply-To: <20240126-imx-sysctr-v3-0-33fe801d5f31@nxp.com> To: Daniel Lezcano , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bai Ping , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Marco Felsch Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706252968; l=3432; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=o5T5BQKnKVPTSdGEy9mYdRRrgmMK7+tO3UEptrQOgLk=; b=J8pLB3fRXEAMmslF475aaHFSGSuGT4kGBFg2uSkYRcPYP4Nb661vtnNi6jOPgqGJQSF5HJICa DRBk9Wb14K1Aq4g2MMy2sCTrRSdqdCtwzth//2VW8eQZc9cjTakl0C4 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR04CA0002.apcprd04.prod.outlook.com (2603:1096:4:197::17) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|AS5PR04MB9825:EE_ X-MS-Office365-Filtering-Correlation-Id: f6e8f4c4-6ffa-4ccf-44df-08dc1e3d250e X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JKulW+EyU31yROhdubTjkcfnsa9ybURBcDhAQuTfhcP5q2XRDHy4S27LS4yYq+3AdmWe54Dfa5/+DmRGMmbKWatRxHyzS03/ONMp/Gnt8loIeQCNKhJX0jl0fRrguXG9DI30yPisgFpGMMpaqjw1WEl3ZCftmNdfZscMxUkqh7/0ftjEBlhcc1a24aHM/U86m+A4eES3WrDgKo62Rj7lelCiWLjTKDLoEMVhzcYLC+NgVx7z6GHUYhjRyrinHwZQQhN8DzIlFtFSzIWmgiVjMmhhsTU77PD4oTlADtzzw19BNmtCVxAa4iFjEj97GEu4seQIxbmEk8vk50bk4rWPwhXO7eN7dA7YLowQjuao+Vntamuig8K2gwNLeQIn9ZCKKegE1vFMyzEriU+cgenhwNzADm5Kq9QcT3EBGL0EKga2/c9gXR7coLb1B7S3JceD8PfJeTHGEB1SR4Tqm5SbWeL3JQPX9CBA0LRC9FpeVOUHi6nHpvCCktGo+xVVc+9JJik++l0Dq5IvecwkATnMTarIMzomqY1DgT0/mhCAgyvG5B94UMx88i2hI9glkG1Xz0yjjZFW9ts9kpF0nC5hssoNpCh6JiOLjUrieTOfYPZ7USYGXkcpjcS3AbT4KFoIp6N+aAMB2RvpsGA2NMGLRQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(396003)(346002)(366004)(136003)(39860400002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(83380400001)(921011)(110136005)(36756003)(86362001)(41300700001)(38350700005)(38100700002)(26005)(9686003)(6512007)(6486002)(52116002)(6506007)(2906002)(478600001)(66946007)(316002)(6666004)(66476007)(66556008)(5660300002)(8676002)(4326008)(7416002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?UxbnEXE/fF9V/efv/BFGsvi8E7CS?= =?utf-8?q?lrbbZ2og+owqBMIX2N3rJrcd6ssy01w1+cpT1UsMykL1Zk2D2ZpcND4CQ7wDYgpgv?= =?utf-8?q?gJlmaHCieo7IiOWWt7yjFfeuJkBD9yW4jFaaEvmDytYugIhSVcAY2TunryQ8rsyqo?= =?utf-8?q?eqg5bxUK8PIukzNA+jhvxwrn8Lx4QHcGjPYQjXCEzRSkAt1O/L02sWmW0VySB1Lji?= =?utf-8?q?mZP2t9jPaeC/T3ifLPZ0k/DfKgUPuFLMMLMsC6vJUIor4+4FjfVMTwNQcGGoYinGD?= =?utf-8?q?w4KWOpKOxj816hIwIgTaMQXoXzezfuKvQU1qgJEbxwiBu7qWat9g5g1YrEW8dAIK9?= =?utf-8?q?8tOaeu+G6mlYVvJo+FdSSjYGzxphVluKnyEmTPEodgCuhX/bmul8IYYys0X9o/loj?= =?utf-8?q?/9sSe2A4YMLMtmhQBuefOB/f09fHWFTAGOlPqO6lGTLX0ombVZ0EuTEZjaLCYOkaR?= =?utf-8?q?anzDDOmwf1iuXcRtI490UioPd3E34DZzRCjkxZulSQZmBx8o3UBS5RHaSYtwGsmaj?= =?utf-8?q?bKz2aO4D5vHVh9A8Jk1rx8abfsxQxPMx+OTLlHGDIWIQoaEkJ0rbECGd8EgLmEkUO?= =?utf-8?q?MPk1ZYCGtNK/p5qoqImuO2FhO6wtWm9lxiQxQ/nOq9+rQxMGhk+rCqbE5HK+50khF?= =?utf-8?q?oqHoO89fqftuy0u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ZFOKa0e?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6e8f4c4-6ffa-4ccf-44df-08dc1e3d250e X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2024 07:05:14.4321 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mj6XVMb8FQPoTon2pbQ6es/ZiFGsbIRmEP9wdSs8lSkzDoFIWxkjIiuTIx1q3iZ6WrZjswfCerxPjOhW6OlvDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB9825 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240125_230526_010916_C5345C6B X-CRM114-Status: GOOD ( 15.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan To i.MX95 System counter module, we use Read register space to get the counter, not the Control register space to get the counter, because System Manager firmware not allow Linux to read Control register space, so add a new TIMER_OF_DECLARE entry for i.MX95. Signed-off-by: Peng Fan --- drivers/clocksource/timer-imx-sysctr.c | 53 +++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c index 8d5bfb8470fb..9b7c021c3b46 100644 --- a/drivers/clocksource/timer-imx-sysctr.c +++ b/drivers/clocksource/timer-imx-sysctr.c @@ -8,12 +8,15 @@ #include "timer-of.h" #define CMP_OFFSET 0x10000 +#define RD_OFFSET 0x20000 #define CNTCV_LO 0x8 #define CNTCV_HI 0xc #define CMPCV_LO (CMP_OFFSET + 0x20) #define CMPCV_HI (CMP_OFFSET + 0x24) #define CMPCR (CMP_OFFSET + 0x2c) +#define CNTCV_LO_IMX95 (RD_OFFSET + 0x8) +#define CNTCV_HI_IMX95 (RD_OFFSET + 0xc) #define SYS_CTR_EN 0x1 #define SYS_CTR_IRQ_MASK 0x2 @@ -22,6 +25,8 @@ struct sysctr_private { u32 cmpcr; + u32 lo_off; + u32 hi_off; }; static void sysctr_timer_enable(struct clock_event_device *evt, bool enable) @@ -46,13 +51,14 @@ static void sysctr_irq_acknowledge(struct clock_event_device *evt) static inline u64 sysctr_read_counter(struct clock_event_device *evt) { struct timer_of *to = to_timer_of(evt); + struct sysctr_private *priv = to->private_data; void __iomem *base = timer_of_base(to); u32 cnt_hi, tmp_hi, cnt_lo; do { - cnt_hi = readl_relaxed(base + CNTCV_HI); - cnt_lo = readl_relaxed(base + CNTCV_LO); - tmp_hi = readl_relaxed(base + CNTCV_HI); + cnt_hi = readl_relaxed(base + priv->hi_off); + cnt_lo = readl_relaxed(base + priv->lo_off); + tmp_hi = readl_relaxed(base + priv->hi_off); } while (tmp_hi != cnt_hi); return ((u64) cnt_hi << 32) | cnt_lo; @@ -126,7 +132,7 @@ static struct timer_of to_sysctr = { }, }; -static int __init sysctr_timer_init(struct device_node *np) +static int __init __sysctr_timer_init(struct device_node *np) { struct sysctr_private *priv; void __iomem *base; @@ -153,9 +159,48 @@ static int __init sysctr_timer_init(struct device_node *np) base = timer_of_base(&to_sysctr); priv->cmpcr = readl(base + CMPCR) & ~SYS_CTR_EN; + return 0; +} + +static int __init sysctr_timer_init(struct device_node *np) +{ + struct sysctr_private *priv; + int ret; + + ret = __sysctr_timer_init(np); + if (ret) + return ret; + + priv = to_sysctr.private_data; + priv->lo_off = CNTCV_LO; + priv->hi_off = CNTCV_HI; + clockevents_config_and_register(&to_sysctr.clkevt, timer_of_rate(&to_sysctr), 0xff, 0x7fffffff); + return 0; } + +static int __init sysctr_timer_imx95_init(struct device_node *np) +{ + struct sysctr_private *priv; + int ret; + + ret = __sysctr_timer_init(np); + if (ret) + return ret; + + priv = to_sysctr.private_data; + priv->lo_off = CNTCV_LO_IMX95; + priv->hi_off = CNTCV_HI_IMX95; + + clockevents_config_and_register(&to_sysctr.clkevt, + timer_of_rate(&to_sysctr), + 0xff, 0x7fffffff); + + return 0; +} + TIMER_OF_DECLARE(sysctr_timer, "nxp,sysctr-timer", sysctr_timer_init); +TIMER_OF_DECLARE(sysctr_timer_imx95, "nxp,imx95-sysctr-timer", sysctr_timer_imx95_init);