From patchwork Mon Feb 5 03:17:57 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: 13544949 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 9C964C4828F for ; Mon, 5 Feb 2024 03:14:10 +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=bYqDx813b6mfy3w/CFpn21CyXY3jILwnUv5HhL9bmbY=; b=f6jEu2BC5+CsWGGvn2PaGkmS4E t1PLMipyp4+O/a7Rzp5psTydTBWipiW12e4XHwz2ccsacVHJkUkXTraJYSgRU+1/rcBEzTbGD8vGy GnYS7+WMUiRaIdCXc9ZWXfXf6p84AeyyjrDg65wzzIt/B10u15kTIQrol5lwwkR4KRF4twUxU0Ib+ FGRqannuomHc3F/4NIDB2KAcU+NF7xwJoHIc+E3nqlEUXs+qNzjqr3nb38dRtsmjJEB6aDrZ8uh/m IO6zRAP1rIABLChA/jkdyIYdwT+qlT6mvUtMqxVW5ysl0HRWM91fkhVQKzzEXP08rDt40ZvO9hKz4 AAcplu9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWpQg-00000001tcD-111X; Mon, 05 Feb 2024 03:13:54 +0000 Received: from mail-vi1eur05on20600.outbound.protection.outlook.com ([2a01:111:f403:2613::600] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWpQc-00000001tak-3Xjl for linux-arm-kernel@lists.infradead.org; Mon, 05 Feb 2024 03:13:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JDUN1A9lR7/JXWTSVEPI4mYMjwju3oxabUnmckKUhwFkARHBPoaY8+sJKy+4wm4PtOeHNFaOmz4l1ksCdD4lUnZ2TT8HcQ7DSEG/HCFg/429Iy2NbLuhoyfF5wSEn7LYNoLlQQZL7w0FcIl+JPzR4h8HLNLjPOBjQTWXdg50AWzfmxNMAM0oVrqmTXGdgFpnxxeXvRL5GP7o6bulHywQtQ5C84myO3ncex/Dt91+3yxqaP7GMiU3mQoxygao+pACEgtXCFQk5xZEHbNmnqqAMOalkc/Md1tR+3qjEr4K5ZufY6H1b2yDLS8pNS58eNNob9kS0pklJ9lDzJf5LJ2m9w== 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=ifTADVj1jYTuSpgJQkwpP5OCUaKEn5cq9ppTHD9eifA=; b=NrNoOmc5wSo/BpMMZMSj6kELR49EWgZs8zT4oqxyYxWnKxxPNJrbzaitvWzlzgGH4QTEN9QCZY8PH8DnNl0YTXbCPBBZj6d9nfVthVzAG3Oqv+vNQcVSJE/J8ox3kkxY2NXt8hHmO/CMbyGif2UetVkYC/NTlqCwdWJx/qrkDjBDOsN/7+t6wnAZXJ6TP2hsDmcPR+gGCJJzeaeNePiQb9BszNsFNqvtRSo8S2iMGkdiSRoayHx93mkZf83fDhadKf4J5SpAQOHBLPFQG/iNoBCYLvjo6mYBkjAgONuRd4J2NMDg8qkNYw2KgMdkf1h9jZ+U1Q/u5/ZYAKpFx1U96Q== 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=ifTADVj1jYTuSpgJQkwpP5OCUaKEn5cq9ppTHD9eifA=; b=SVj91D6EEWYk1OblPJX56pf4DvbUh/5Gookoet+UcKcJ5Gk0WTXUC4+TfegwtEoORMthGDGNjSdGaKTe8EHuM6oR43fP8EbIskcRozzvy+dOvw9jX0tUQ33ol63CB+8GH+oET1hYum3XW3fyxcndTNUUkhrod/Xz0u/TXfkmPxU= 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 PA4PR04MB7775.eurprd04.prod.outlook.com (2603:10a6:102:c3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.34; Mon, 5 Feb 2024 03:13:45 +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.7249.032; Mon, 5 Feb 2024 03:13:45 +0000 From: "Peng Fan (OSS)" Date: Mon, 05 Feb 2024 11:17:57 +0800 Subject: [PATCH v4 1/3] dt-bindings: timer: nxp,sysctr-timer: support i.MX95 Message-Id: <20240205-imx-sysctr-v4-1-ca5a6e1552e7@nxp.com> References: <20240205-imx-sysctr-v4-0-ca5a6e1552e7@nxp.com> In-Reply-To: <20240205-imx-sysctr-v4-0-ca5a6e1552e7@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 , Krzysztof Kozlowski X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1707103086; l=930; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=R3Mof/eCE3OJuvH86ahzlO+hC65KLueYK0QmUKdlf1k=; b=BvCwBGBde+Mue8cogJ4dxEungzIGT8+VH6r+TaxapChoZW074VXBTYh46Ngou/qlZVt+ek4eW erN8adRNax+DNImA2km51cRrknh1mUzzBDuQOgT3RY3nbrnztCsBoR1 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0124.apcprd02.prod.outlook.com (2603:1096:4:188::9) 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_|PA4PR04MB7775:EE_ X-MS-Office365-Filtering-Correlation-Id: 9594af99-cb50-4813-b92b-08dc25f876aa 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: 3uOp9eo2/0IvBm08SuIpr/vDWzg1IJWeQXa4nGRuvu84ZP+KInotOOxlkBBgGs4d8Yz7NwZlrX8nrINc0YPosm44/rqngGkNYqxi07jZaS6D9PkCsutZOxLH+XgkhkkUIpQ+/l2maqGn49kFjt2spnspBsSawnsSra5cl3IxVnu+DLs3WuEY+e3/clZsoIK7kUvqgYNpCvg7nC4IDRCjDbO7y7dEr+5/7qSMN4uLy+hpLrCFkMQ+0DhVr0WDatUiIPe/APUknQYpp1uyBuOSxA9ZsKWPVJN6nNjWb9xakPWItij+f4EECQaPgmzA5aHR0ck1MVegRclv+e1frcdjCpxQCqc+sNXRC7DTEVtRFbmyw0ipl0fm0SIPcXR7J59T4QHsPJAXmxTzylgmHBCznMMUK1NnBhPIzGReo3kjTkCxQVn+dAUYO900kgU1p2BForrXj80bSp6AqXaJEPIGDlR5sfhzt8yXCpXFGOX9pwYLfsSAzthBoBrqPyNO/IFb8TGu6mQIgfHXsvF92vuhAGB0ty5kXUfpdYlhy0aBPbov3NNGso21rrNp2qcoMr7ho6sqJ4edtvoSo9x/IlfJNTggy0V0K/IAFffw9CorCs5Kri+7pooxt5TRWxIKxI5X 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)(39860400002)(136003)(346002)(366004)(396003)(376002)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(6666004)(52116002)(6506007)(83380400001)(38100700002)(26005)(86362001)(41300700001)(4326008)(36756003)(8936002)(8676002)(9686003)(6512007)(921011)(478600001)(2906002)(6486002)(7416002)(4744005)(5660300002)(66476007)(54906003)(316002)(66946007)(66556008)(38350700005)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?IWGDthE/2g+liGkeVg/pufdaqLZk?= =?utf-8?q?ymlUuwuDl9ABVlxHFWTuqBDVaHG9WsFHwn78ttoKQC4azTa38uCf8uI9dDlveTgYt?= =?utf-8?q?ebVq0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HihhFO4eBA0++HUTLTXnmHLB2owWTc4P9ESCRgp2SnK?= =?utf-8?q?eDNco7GOsBEMGeR6N6L8Sc5hLG+i13KEiaKSD9aVxfwMnPTU5GRW0aIMkslKn5PNa?= =?utf-8?q?2u/RAJkeobYNgnCZas22zUTHFUhzV5AwQ1NhNOAZst3AwGmATp0lfaamPOMYR6Yt/?= =?utf-8?q?iMp3XauAs+uqgh9ya3tMerDFNyvb4hYiPH7hAvUIqLowWOLFqgfEbM6zpQpVN21wJ?= =?utf-8?q?G3zJhdkIiQ8z7mZhkpVyo6gBAPHUdGr5JgK7LZAP9m3t1HlwPdYr3gBJcEbus8uWF?= =?utf-8?q?b2aozMV8mvJxQVjatDmJzripORell7upnEkJc8Y+pLsT6s+XstcXBg3Ui7NczoStk?= =?utf-8?q?Kqr/PaRXAdb5lzZGIDBzghsoBYm4lRFI6QU3V5iPVvA1+RH6QdHLfKEhqt/nSFeyZ?= =?utf-8?q?nXUzuoCs/gu/368QOZS0tHQbU6YOJDh1Q4v+c+lC4xr7xwhToUgXvqb+ELope/Mej?= =?utf-8?q?g6RBg9KC7zRSf8/M/nyesEMuytVNrBAB8DD4fxVVzNxSMFD0jtwV9Z2qwtSAPOMqE?= =?utf-8?q?T/NoLCwUiH1f?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9594af99-cb50-4813-b92b-08dc25f876aa X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2024 03:13:45.4060 (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: nOE92U2kUYzYxhRJNRCIgbSSx6SI8BNR4NO7Bf4UPaT69nOclAQ6CsaWuN88gr6DqPG1PkFghLyUGjefdyc/FQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7775 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240204_191350_926216_703FDA71 X-CRM114-Status: UNSURE ( 9.88 ) X-CRM114-Notice: Please train this message. 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. Acked-by: Krzysztof Kozlowski Signed-off-by: Peng Fan --- 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 Mon Feb 5 03:17:58 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: 13544948 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 79A69C48286 for ; Mon, 5 Feb 2024 03:14:08 +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=3NgqO5huLfK51MrRBa6AVDVISFF+HGV22nFORNf5GgU=; b=o/25jKw+FDPHDjv81dr4L72RCC ERJpKF1un53Fd1H6KzHVfu4JWh8eDjSj76OpfbD8gHK7Np+SVnAtCVhdhNFC0tEJ5SXqtLnZry74D AU7P8aminODvMJOLsr4e2WyWdf3/CyAzHxF6EibwrvwupmgptGocGC2NklnrVGUVINsWqTdvAU+xu s1vPonfhXXKXxycNkL8hHq4mOGK3gT8SRv/cn2O9Of3B40BC4rh8ZX1FHhtpIV0KtHJpUZkJGmcGk EzKRov47Dy8gRsLactUOvJ877vWvZp8jdVUZ6ycgJesHXsB0ZnxNcSYWit5q9c71RrV3Keu9To63H Wu7UV4Hg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWpQg-00000001tcO-3ogC; Mon, 05 Feb 2024 03:13:54 +0000 Received: from mail-vi1eur05on20600.outbound.protection.outlook.com ([2a01:111:f403:2613::600] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWpQe-00000001tak-2DK5 for linux-arm-kernel@lists.infradead.org; Mon, 05 Feb 2024 03:13:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UQ1Op5R36Xp6WN1weBGNdP2oZgTj8DrqaYrlcuBcqeefDw1EqDko4f/0SmAoQIT5HrX9jEQ4dU1MOgqqwc11OHsPuP1Pvd9+fPJfonJy+hgEIqFo/PyxwiWU6T9vgEGQ/ZYQzdRWgTkoIVV16OJPDj7jI5SQ1gIAVaYPkQNS2o6HP2vYMFaZ6VwvH+HX81XjSAuBm2JFhVVpP9BnjWFdOUjWzqVsQVq+lDLFh0RPtFwVFRBIXjqOUv/4/O3V3w6NuZxQqZzHD3PJ6W7SapR7mw/4OuVwQ9Iv0VFRFxIwqZQFjWFrVNFnVCsJQm9N5EoCJl8hH50sFkdK7RKMO+ANPQ== 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=ojj9JFqx7/SKG+NtV4R+WN6A0aMY/vM2Wbiw0lOFvc8=; b=SWW6SCzpcPpivoYU5TLbOK1tf0kdI62m0JliiL4LH+ImKc2KyDGCNLtlMepK/gW0dsd1GNoYvujnUrPuGnzOuoS4vbGu+1bAKOQsjz2XLu0scpRnuu0RxRkkrlgx8fSWT/GqaJ5IWzbLucFfMucGiRUurO6exJjQRK8e6H5kUur4Zo0tAoIhD/Wq4/TDnrH6TKzsLhEkBuD8jR8zBrHV2cIIxH/0YSAdlNgW4gyWEuZ40ChM1/PRxakNV6vv3Wx4hmdNWI7j67B51Lh53B4q9TGIfoiG2J+tgb3/Ib7erBBfauRcmkeF+6LUx1FiqyNYuM9fRlaHf6iLaV7+A1dZgQ== 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=ojj9JFqx7/SKG+NtV4R+WN6A0aMY/vM2Wbiw0lOFvc8=; b=FZ6OYFdSs/pzePz5AWs1G9e7AGJ+qgmmxV4fouDcYo/AIoe7bMx7sN1u4kCLa5ZbgzBLlVmGAnEmk0aP6kl2WeZJZkJz/5vWengG18d+BPchU/Tk02Qxw1+wm491RzPHZaSI1MYbxjnU2IKth95CPfaBjktevoWuWxdtTIu9sMM= 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 PA4PR04MB7775.eurprd04.prod.outlook.com (2603:10a6:102:c3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.34; Mon, 5 Feb 2024 03:13:50 +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.7249.032; Mon, 5 Feb 2024 03:13:50 +0000 From: "Peng Fan (OSS)" Date: Mon, 05 Feb 2024 11:17:58 +0800 Subject: [PATCH v4 2/3] clocksource/drivers/imx-sysctr: drop use global variables Message-Id: <20240205-imx-sysctr-v4-2-ca5a6e1552e7@nxp.com> References: <20240205-imx-sysctr-v4-0-ca5a6e1552e7@nxp.com> In-Reply-To: <20240205-imx-sysctr-v4-0-ca5a6e1552e7@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=1707103086; l=4899; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=S7w4NqGjFN883vSC1fzkHyfccuvNVL7NR4MRBDh8Qms=; b=bD9PSR8u6DgMlZb1CM7VZyCiBI8l5A6qOl3CSEuPxz8QpI3az80lzl3T1cdRbTKP3WyPKbXh/ XB+QHefLv2hDPFbQdNVR7SsApbvIJMxpZrNyw3iDWwxaM6WNrs3CkVj X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0124.apcprd02.prod.outlook.com (2603:1096:4:188::9) 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_|PA4PR04MB7775:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c2844ee-13e6-4f55-aa0c-08dc25f87972 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: EqToun86n84hAFq31qRQA5jgCxHqTVzEoRNZfAyfDdiqpI0Oq8gymhvLuG32HejILzihv1rVxpvPiDrtyEU0tpGCVDndIjYCSp3isP2Q1kn6FTwfa6DDepS5nxW0JHDH8dQOlPEkbM0rS/N8eVV2WJmwXi0/7aA6r+T/M+JZPoQ7vUSI4SNYDGJDBJfEoK/p8xd+LeqsdeWMOf+n2vECeNdwTQVTkR/GLa0pBXBC5nOOst9ekk/yBOLL+g1AXDtr+UxwPVvahPL9b1vmRonfiox7qlq2lp2QkxT9FAEbCh9vurKXuE1Y084lPh+vQe+GjVZnzGRSJG9qsHaYPXir+Iy+hGUfwcJWq26Mu7R/ED00dMUitkV4r16TUGvTHjmZuH5Xu7U1fV/8X+odu61hNANcND9sZH3k9LaDqyjpbnnpMYeSRcb9wjfV2PX1J7kU5IdLzMtbzPznGBbYtulHhNOJC9cld2G2/+pMLNAvB1D4jTXF4PwonAjRrbwgaDrfjgZI8DaXl/25luTiBC9/XiynZWBW6h1Kjzt81penHg7KwHWpxAeRFgs2bh/CcGRWU3XHuq6F2yA+rwNtkZup2uGp9hp1/BUcDuKGukE7QtdDNGBVFgbKmx/MSnaJqn1efzL7Tg8Pdb4Wy2PaPGiOGw== 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)(39860400002)(136003)(346002)(366004)(396003)(376002)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(52116002)(6506007)(83380400001)(38100700002)(26005)(86362001)(41300700001)(4326008)(36756003)(8936002)(8676002)(9686003)(6512007)(921011)(478600001)(2906002)(6486002)(7416002)(5660300002)(66476007)(316002)(66946007)(66556008)(38350700005)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?oPhJkuKAV9j0H6mgRpgMgomOkXF8?= =?utf-8?q?kP3Ahkhoho67UU47LqXVVeEbAlnnxyKmel4I90xFS4I/Q3q0DQ24I5SdivLzWV31J?= =?utf-8?q?Rn3YHgnPcfC1gTxTWEAKfhbtiABkg3H0OCWBjH2XYo/3tSZWUJuiMZoLbtCK28DC1?= =?utf-8?q?fBE4oYIr+auiG/83OeOXZ7vBYgh/KCUYoFtK+AOpoXFEDckNk+0E3dvN/cLy+682E?= =?utf-8?q?hmDpNr4CfiDz793/MTyWYiKgXUuTaKpZfdRjNRiXLoZUIAXcDOAz4TZyJbKu9KPQc?= =?utf-8?q?lGst/e0B9X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wGl/DfYHd0c6M844y9eVViOT8/5OZn1REzLT6isDVWIc8MpdF9xr?= =?utf-8?q?fVPHNAAGuE91+UJlrK0VsTW27UGFVdIcSyiO7YFFcMVRPhCfTsZd+n7R7HOKDL647?= =?utf-8?q?UIkbDHkvzvJhJ9ni1FE4kbtBA6jy0BAYZP4EeDoksu8q/JBLbozTCWtj6wWHcxv1c?= =?utf-8?q?7/lUPb6JV5qs15dKAqyog1GmRcBtsVDEfFS0cuP01zMxNRmMgCLTqShHJiU8qWmt1?= =?utf-8?q?fP9Q9FL+w0lsP8ZIWQQT+Vb7id+t3dJ+O32+RlGQGvNrpbeONGOgPDcger2ka+lYD?= =?utf-8?q?DQP9L+Et1XkXaYE/pTxzwbzwUWCtgyNJrRud5dxNOvPZuKgdPbOJX7QKoS8F7I3JE?= =?utf-8?q?CerNauzNn/LN?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c2844ee-13e6-4f55-aa0c-08dc25f87972 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2024 03:13:50.0253 (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: EYGeEci0ei1IChQHyk6jVqdLMhHVoT+KjakphIEZm7mMsZmW9xDKdfD+M+bvSCLo4ph+n7C9jrapnzrY60utDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7775 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240204_191352_636351_67D33E84 X-CRM114-Status: GOOD ( 18.69 ) 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 | 76 ++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/drivers/clocksource/timer-imx-sysctr.c b/drivers/clocksource/timer-imx-sysctr.c index 5a7a951c4efc..c075ea89a214 100644 --- a/drivers/clocksource/timer-imx-sysctr.c +++ b/drivers/clocksource/timer-imx-sysctr.c @@ -4,6 +4,7 @@ #include #include +#include #include "timer-of.h" @@ -20,32 +21,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 +62,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 +91,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 +100,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 +127,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 Mon Feb 5 03:17:59 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: 13544951 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 7179EC48295 for ; Mon, 5 Feb 2024 03:14:16 +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=8663CXpv+5lgUVUdifk9BtRHtZo5G/JVHSlVbIxQ76A=; b=ZFLQL+pD5ME3NPQPZbk5nxIEaG omfuLAk+L2JUlX+g6TQU2Qw6cbVvYivNuG5AZW5iZrdWfNA8ABQOrylR+TjOxFvSO33d8ABRAxvFo 7JubWgy8GTgQZP2Uj4G26JB3fKUVB8bQKp8JQiaWCU9Aej1uFTeApTBa1uenC/InAWURblHFgOz0w qsF5+pQgMRAiWw3KO6SRgWrPQKZ9XKuL63CFPeUH1+/Vj37SFYFFwFzbFmQp+0Amc/mTF0tthd3ep 6/jLGe/sk0nqF0KfzntyNlqe5Twb/9t7JOArQ0uCaKA7X56syk9jbUUBF7FVco9dFcENhDzEWV1qm 9i7GL6OQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWpQq-00000001tgn-2aEV; Mon, 05 Feb 2024 03:14:04 +0000 Received: from mail-vi1eur05on20601.outbound.protection.outlook.com ([2a01:111:f403:2613::601] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWpQn-00000001teo-3Pog for linux-arm-kernel@lists.infradead.org; Mon, 05 Feb 2024 03:14:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cCQZNUNJc8uIxPPH6ro5qLu1GTlLXC6teh1Gw1Xh+kLVqrlAeuvkV06ceRphpYSfW+3XbubV14xwF3pXYJwojp15sqgZtmPhfYr8OWwL7snfJYiuCrPDHAwkZ7MhZ+G8R3+az2jvG+o4uiW8Xqm345AlPUnSVOsRiivxZQ8w5AU1kb73Lotd2o7Eot9cWKcGwKwD4LSKWRENxD8DEelERDIOoVynYV5/NfPJYugQZDHKPedD3of30BVvVEH2X4eRw7uSI29v0TOzmXbo5iBydUg4oU+SiWXv46F70vgdeZG8wRVYA+uYFaLvJXmNEd8Lnp1Bene+zkRHFZratiLLpQ== 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=TegOzBMjAC22i+VOCdqXTFe0niiil+if8P6XAWAiVSI=; b=J8NV8Tu2nxtSL9ElHy6EUNQrMmuxHge+4zjqCH0Tm46GALWcfAAd787eLhdtw58webuh2n52mWOKXLlvySWeBZZEruE0amdSMpw56kDG8lGexke2VwLUH2dTsHvgjj1mwIz2kUVg8ighJkdDdsdVSqtPjGtmf7JUAFYZ37QUYwB84V0ZvQvNsYgDDiHhDNRzJ4JCOYi6cn/vJqHn2/tD6WXsNq5q4U3R2fzmszhCMPHbP6zVEuuni7SisinKcPvAUSyWmlVfcoxhVAv8Svs3p2eL71OcSVBjh/z5kMbkE77U6W0lWFi6vjS/KIzBDrK8W2wAharndACW02c8xhFVaA== 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=TegOzBMjAC22i+VOCdqXTFe0niiil+if8P6XAWAiVSI=; b=T4188pvJuttHCJjPYP073F+fwHyUXTHmM1RNtqfM16z3k2Y5y0ES3xtyGSii6g8IDY5ZVxfQir0DFgAZ0b75S+TGX8rnOt93ibZXpHMYafLtXSiF9i9LEmUvvScj083LJeidJhQjTbf8i3tOtI0I6cpS5Y63OrMtVIVGSPyZ2Go= 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 PA4PR04MB7775.eurprd04.prod.outlook.com (2603:10a6:102:c3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.34; Mon, 5 Feb 2024 03:13:54 +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.7249.032; Mon, 5 Feb 2024 03:13:54 +0000 From: "Peng Fan (OSS)" Date: Mon, 05 Feb 2024 11:17:59 +0800 Subject: [PATCH v4 3/3] clocksource/drivers/imx-sysctr: support i.MX95 Message-Id: <20240205-imx-sysctr-v4-3-ca5a6e1552e7@nxp.com> References: <20240205-imx-sysctr-v4-0-ca5a6e1552e7@nxp.com> In-Reply-To: <20240205-imx-sysctr-v4-0-ca5a6e1552e7@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=1707103086; l=3432; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=pt63jqyhMBliY87I8GK5zQvXIIYgDLjOAKhWPgnofho=; b=GqakVs6kgXKRZxv8TrVvQlfyHNAJcDJEEDRMdZFpGhFn/ZlKyFmXsBHdRH6Slb7IuW6XZg0px RZK36fPr/ebD0c2aMPWNc9jmGlOkZw4YplXoMSt+i6Cq4wmGQa98uJ6 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0124.apcprd02.prod.outlook.com (2603:1096:4:188::9) 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_|PA4PR04MB7775:EE_ X-MS-Office365-Filtering-Correlation-Id: fd816224-d7b0-4ac1-8598-08dc25f87c30 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: o3Fh/5N9irtaT4x/8a3rxyvlMKpkfq03hwyRLPmw1OEBKowqC2wQLIil6mDxikPAMRl/6K/98vJns7N1lOLyH8UDKUWfbYqgJd8ITgG1oNfRbu/ANpXD1Pt/b+4G9JRIn5uyKmo2IYvVQZYtMXT2cY+yZ0XHKQ227S/EEOcKeFVJWdfbypZkZg4iU7oBxOa1zKSsYOaBoFTyAV/YVcZlhgSA8rtMixDOAIv6E+p7OsmxiLI/8UyKyl7RZFY0BJn2mt9fU6/ieCnGmPttCidgfWBL03lm/O5V+Te3Qw3JLG8oA1mNKclG2VHfEqY7Y37JdhTSIMbpEIZKXULy+TPvrtPOx8Y8fP+J74lUWgLBpRLkXQ4x5xloxd9nLJ90/hJzOdMR3p6przTxOHaCsY4iisyKB0jfbcaJNq6ZPPC5v1+PC0fFaKThX4DPkOFy/so0+XS4123zO+D6QDSKKsZaNb6QlB9Uka0dwW2xQxSR/o03nsh8DuK8uatkHDga2+5PJvSDrMcqknc3lIb7Fr/asDE2KUR8CcBBGmYU2P7EVp6LY8tSOub+7pPJK8qa7rBl/pAh2na1DHkGYL1wQs2PWZtcacrtHaKMfIGeZF7TBPU3L0Y5OYiJVvwrGBQSka6JyjUEqJwc1qV385MB3hjNCg== 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)(39860400002)(136003)(346002)(366004)(396003)(376002)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(52116002)(6506007)(83380400001)(38100700002)(26005)(86362001)(41300700001)(4326008)(36756003)(8936002)(8676002)(9686003)(6512007)(921011)(478600001)(2906002)(6486002)(7416002)(5660300002)(66476007)(316002)(66946007)(66556008)(38350700005)(110136005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?mZxb6qcOcCq97hmhnq64hv1aLvbJ?= =?utf-8?q?hO1AE1SLK+RST7w9tVT40ugH6TLTSG17H2ERu0WjHxMr7+fleqc4IeISwN0MOXAJJ?= =?utf-8?q?P43nJmR8EiCY7p0nJ9tJfwsAe4H2o1erBPOUl2TpthCiDvTSFp3Pl6SmtlUYmtX17?= =?utf-8?q?woZB7oartWAewTEggD98dHKup9dkz8+3q2XaE42Q44hp5T1XXi7ubqD4HLoSxIcbV?= =?utf-8?q?wab1Dir+CV5Hwf2gIGqUaVrrrId70XeiUpgePPDvPfUPzL6w+7uvpSPnYSl2hIvG2?= =?utf-8?q?dSe2L9G+u8AIL5NuVEUVig4rawuuHXMFCrHnA5HPIJpu8sioFlvQy8gvbLMDOQTZ7?= =?utf-8?q?Rrouh+0Om38XdF265tObTRI3QaF/dJt0mZeVJNuG35iR4FWrrgQZT2xyzqK6lRxVi?= =?utf-8?q?x4n0n48HYoSAgbroqPcBCXy0tPgeDeuX7pF1NutIxwoh8W5L0uCpaZdzHy4mOC1su?= =?utf-8?q?kZdC+xDV7eP0qjEJC/LCkvdcPI4yYGdVxiWgMtnDFmhcjx8pGwXuT7zBWHLQtyOXj?= =?utf-8?q?e4GSnKE1awlw6trAVO1K/Xoh79FEJVV3xjqDzKo92p/cGNP6daPj8O+DAAsVK3Etn?= =?utf-8?q?oN1JpQ5N3JkkaazMB7dZsfF77nquwjn7h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PP4leOvltprWJXoBDlh?= =?utf-8?q?Q4l+O+GNr6C0?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd816224-d7b0-4ac1-8598-08dc25f87c30 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2024 03:13:54.6711 (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: +udCGzz18f7bRfUl1qAAc7eoY4v5GSYHWL/o3Gr7XtTyLJ4wz6wy4dF66aFInNNGrE0zRxMuGfxjn6Le6sOhYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7775 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240204_191401_897383_A259C1A2 X-CRM114-Status: GOOD ( 14.82 ) 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 c075ea89a214..44525813be1e 100644 --- a/drivers/clocksource/timer-imx-sysctr.c +++ b/drivers/clocksource/timer-imx-sysctr.c @@ -9,12 +9,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 @@ -23,6 +26,8 @@ struct sysctr_private { u32 cmpcr; + u32 lo_off; + u32 hi_off; }; static void sysctr_timer_enable(struct clock_event_device *evt, bool enable) @@ -47,13 +52,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; @@ -127,7 +133,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; @@ -154,9 +160,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);