From patchwork Tue Jan 3 07:47:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13087282 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 8702CC46467 for ; Tue, 3 Jan 2023 07:48:34 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gXdIYJp2KrMx/r10uoJh+nZi91mdifvySimZEZ++wfc=; b=3Xy5MZoXNQn9mN VMOeBuv87yONaFrPeJ/5SCzOyV/Vnc0WH0qi/aKPidxYWV9MMIPEEpWRFyPRJudOkDVV5kiPrTE8n fkgqu++QD7Mac6HqlZRnkfpdBODLs62NiqjdjPxDxiyVxGm2dnb5FtN5FAt8R/rr6D3nFkTilMLxp X+Xdc6gzQJHi3wEKatQdMbPiWwN0F//ZRW+708RxVRuniPt3b50ydMGmA51hcVzl73CFIz4lO0L4E pEO2ruSTL1VicGHWevjLLXqL0h8XJlQZnJ4BWaNihuYl5Jr4ynRGsHpVQ1vbrIYeTmKwk0YAUdlut lTroJ11WEXDJ8EEljpZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCc0u-00HXMQ-Nj; Tue, 03 Jan 2023 07:47:14 +0000 Received: from mail-db5eur01on2041.outbound.protection.outlook.com ([40.107.15.41] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCc0K-00HX7i-0K for linux-arm-kernel@lists.infradead.org; Tue, 03 Jan 2023 07:46:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KxkLULHA8QKvvx+DbLUtVHO1MHKNhTANQQGPY2JpiggEMUaSJaYlXSlfL3LgPuTn5QEdQ8Cwj6mit5/CoS4XtRtaYCFFvdfVCmcj68fsVWO/w9RuCRclFcqsIRWHHhnpmroMLAzNwfrd/R1kqUiHMiCH5mCJQM1/7bsSdr4HFJSu3X9wE8dn8mtdYDyFa8zdfpAkoaJRmtUlNvpi8U66XoGZ8N+3fb6IftWMSa2Oya06gV/PXWTd1gLmjj3a/ldg+i8ngmOsSCvPEHvp5NnmfUcrDZTxPIZnhOMgGJwdbuJeBrLNNYQIl3Pr0aZdSqjhC2GL/ssY0LcJRsA2Mbygwg== 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=/gq7oD/ecklTQwXERUtX4H3x068GDQp+NEC7VxnECdw=; b=G9Wb5hHjgwP+STV4q8l15gz3oGSpBCNh1nTuse+SliOP2PUR7HJYMKBwRU+MkZSYEfPshot9EDt8Q1xo2mZNEthrAQdBVMAnuwnRO1yoWn0roVIewzA1fwezmgw4A+eElkdCc3H+63KPu2cYeDQj8Tv6phiDjyL2LS6LbvYRPvRGNWOWfD3okqi/exMoBb3lI5kmD08gAuAq9u3+W2KXsqhC8GriWzid43FGF3G/NOOiJgoHYSmp7ZP2JAYWHFhJ7SuQeTZy2l5htLyK0MkE5LX5XG7fO7zUXY2yyYOcdIcHEFviFPck23VTdteMrRQauBKfKYsR859JnWr4VXYG/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/gq7oD/ecklTQwXERUtX4H3x068GDQp+NEC7VxnECdw=; b=OeCX2cMqWsNua9HtoYbnG7de39M+pWO3cIz0RdV6zfX8fq6RnfD0bHFUuWDFt+5s94OvZw9Ve5IF3Siz3p3j3Jh0hwXYOR81P0M4EVZg7Ynp57Jh6/zkrxKGYksmV+eeCH/VuF7w5Jg02f0am5Dap9X7dYmHkQlk3dfWkRhYW5M= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) by VI1PR04MB6894.eurprd04.prod.outlook.com (2603:10a6:803:13a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 07:46:32 +0000 Received: from AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::286e:e16f:828f:f4ce]) by AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::286e:e16f:828f:f4ce%8]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 07:46:32 +0000 From: Jacky Bai To: lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, dmitry.torokhov@gmail.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-rtc@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, festevam@gmail.com Subject: [PATCH v3 1/4] dt-bindings: mfd: Add nxp bbnsm Date: Tue, 3 Jan 2023 15:47:39 +0800 Message-Id: <20230103074742.2324924-2-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230103074742.2324924-1-ping.bai@nxp.com> References: <20230103074742.2324924-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:3:17::32) To AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8650:EE_|VI1PR04MB6894:EE_ X-MS-Office365-Filtering-Correlation-Id: ce795f44-60d5-4baf-849b-08daed5ea169 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KgXcGtBtSRpSV/2ovlpoRofqCfcpKnNv/iu01slaMlNce0zOYW0Zr3EqKsv/Uu6lqvuXVzeSBkvIKBP50aKWO368b0kORD8qfi1hdOoXRlFVgH4bdDOwgE6iP0zgTvaftycvAM3eWSVPn4R7bqsWvuWn/QtRfnjbXp+/MlaHwJYnULydo3RXp8LpFF//xDDEzhPdAKqkthsAW0Xv/dVBTKgQdZVHc6+ecAI2K5+HcpQADVw1Eu+FaWMbnJ11vLvosycdQWSr2+FujARdqQSUbYuIe7noqb1zWXdih1312veemE2dL0XpFwqv8r/czlytbBVllnYcLiEhzhl3p+CMZVSVsOqq5XTlRraKJLQgouC6wGRC3o6vdYZ//JI2P5H6/gjPKl4bKFZ902yv3Jcz+kldst1lMtylV9/19dGhHdjO/Y9x62TPBM+G1qRU9izQ4lPPRAJ9um2rH1dPeRjDtdBmay3FzOTpClnQCXxHUJ/IvPC/w45L/kP4pmeTyLWEDSDIigF1DCYsYM78DsSxugdtHCHBuqFcRn2zt31Cq0dgqXJRVocwH2LNrHZVwwEjBrD9i8z03d1VAmsv7BU/FiCzF0zfhYFwFgFUv59hb+faJnkg7tIeq56euYpql+Z/RRB1ZNym3T3KOYrjL4vzILosRwHuWkRL9BIld+R78s6e7J7AOHecxrwYYra1ZpXw2hB1Zow7AnUUwfb73g1LezPor6YaRL/LvMg7sdm5/YPot0Y5JYAUP9kmidWpm8yhtkmIYYc9VaC4qY7F3wVzCBa5c8w5he9Ce5WjKUvJ8Lw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8650.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(136003)(376002)(346002)(366004)(39860400002)(451199015)(8936002)(41300700001)(2906002)(8676002)(38100700002)(66946007)(1076003)(38350700002)(7416002)(66476007)(5660300002)(66556008)(4326008)(186003)(478600001)(6512007)(966005)(26005)(2616005)(316002)(6486002)(52116002)(36756003)(6506007)(86362001)(22166006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uFNDkPCyVQfZd03jDZp3zXKeMrP7AYt7uvZ/L5YfpG/Zf5nhq8Q/IABc9yr0Y5zCdqR3KbQRxFuaZjsJpUltqBobt3qTJ+BNG6uBEOJVPrBlhVyfPVGdLn+Anck5mxjY/G6KAJG0dusQfOGegTTSTvHv35ItjtxjWcOdVtzYPVa7e4DqxJMSNe2mN35npw3Nx5jsW0UYz5knZy2olM+Xks+LHzOGp93Unf/xFzZcFGevB/Lt9qEkTxMHkePDBK0nfPtyTa3YLbfaAkIPU0LpzIvnLAoTn+lFZ1kwUrlFedEkvOjUYiI0gwuZfeTVscN5yTmPPWqlRtfFZRpO//+rUN2QOiXOpe41JPW4esH42mrQD6uQ8Q20DVuD1rGQoAinQbFQxPFRurojU+AHw59mZQFM3WKru/E/mQ0Xac+czhM2bPkLoh53J9v1U3/wcbCe65UAQh6gVyZSR3kXnnFu1EyNxUx1/2rBKD9o5xA5Bnc539nyl1O9ciL+H2Ggv8Ds0SZSNXlSVJVCxe/u+o9+h9VCrbCLb8B6vGoYlzggHuILhANWUCBOtoE2d9kta78aohlb4E7D8dqKhu+4nzRzo/mR/0PpROB9EJpTXKfFiWdacaN4GalJPwLyW9IMOKU98+D8pni7tuOlEl6h0uhSlNz7dnoNGLIme8cnnM/e7ghGqTwSR8w70YksB+T2rm6kHaLkpR2M9hRPxDFhy0hE61Q6/g1rfpI7d32NwYsjs+p+QUwstWkoV9EVT1pgObPuO+RthjsWS1XQOIIjbwPZ5TMCzAUFiK2tA9lXupCws5FwLlWcXIdLnRJYda78A7tb8+IHva2sdPP82EdTyMcLaeGmjTwiHsjzxlVZbEoHYkClXUoe0XUXHvg7ieAo8pPNr5EvQhxjbhPyV7z7U0Y/PIsIQW6ftevhcSHvSU6OcM0PdRVLT4BdI1z1VoROBOZGmVTTBGZ9/EUYOk1h5oNCwxFA7jxuNJey18ttBqq3gt/J4msmuetN0japn15Vxs2NejOOmSbXYuxF5PavGzlr293Mfm6Qfr59Dj/Pd1qj5T+8vBvMDagkuXfCRxHqkv7CGpC7ucqwa0iw1NMwKnTOBCbstCsdJ0SCPhgu0x5Rre93i7qwGWJKNtqX/z9gJ5s77EYqLzX4NPSz/ovtDngkF4f4hX7YV67+dtza6jlVitbhhg1sHGXGgVYrzjEtfh7gyu7x6epfB8YNBdKxIFy0UZcIoRX3qQ3nkf95J1Bzy8glb3W03yRBfBwaPmArGqx+H7KF1c75nzvvoJpnYtBUAa/jOgK1R1DWSc+FpFHJywmBrc/JIEP0eO7MQzowr/HqmRe0Ml9rwoaQMxpnQp28/xkdFZKwmeCEdAacMJpBS7cb6VxYm3brFAAgaiPazipAHTwLgPJGa18ItgRcDQqZCv3DvrdkSCwNPk+gTTI35YNeF4+4XaCOK2qcsRNdayXktaotdGR7hCXRLwd96cx0iweO7XEG33zTGiB09WbyP5gMrnsiMbTJibBlRFKDYmKVpnfZU9LvajuIZmOCsRbP2IioRqdDd18BAbiJB4FESBNlParmTx3WiVsylISGHe7x X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce795f44-60d5-4baf-849b-08daed5ea169 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8650.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 07:46:32.0708 (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: C1c0ud3M80diEZXqQEiEoQ2hh24xjoaerHwO7GKkGZ1GNnqJ3M69htb5aYUu2DD8ojQUJpShSIuU84ZMZBEvtQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6894 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230102_234636_149144_8D0A0DC1 X-CRM114-Status: GOOD ( 16.52 ) 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 Add binding for NXP BBNSM(Battery-Backed Non-Secure Module). Signed-off-by: Jacky Bai --- - v2 changes: - remove the redundant 'bindings' string - add ref to rtc.yaml - add start-year property - rename 'regmap' to 'nxp,bbnsm-regmap' and add description & type define - add header files including in the example and correct the indentation -v3 changes: - remove the 'nxp,bbnsm-regmap' property, get the regmap directly from the parent node in rtc/pwrkey driver --- .../devicetree/bindings/mfd/nxp,bbnsm.yaml | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml diff --git a/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml new file mode 100644 index 000000000000..bcd8fbc6e297 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml @@ -0,0 +1,99 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/nxp,bbnsm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP Battery-Backed Non-Secure Module + +maintainers: + - Jacky Bai + +description: | + NXP BBNSM serves as non-volatile logic and storage for the system. + it Intergrates RTC & ON/OFF control. + The RTC can retain its state and continues counting even when the + main chip is power down. A time alarm is generated once the most + significant 32 bits of the real-time counter match the value in the + Time Alarm register. + The ON/OFF logic inside the BBNSM allows for connecting directly to + a PMIC or other voltage regulator device. both smart PMIC mode and + Dumb PMIC mode supported. + +properties: + compatible: + items: + - enum: + - nxp,bbnsm + - const: syscon + - const: simple-mfd + + reg: + maxItems: 1 + + rtc: + type: object + $ref: /schemas/rtc/rtc.yaml# + + properties: + compatible: + const: nxp,bbnsm-rtc + + interrupts: + maxItems: 1 + + start-year: true + + required: + - compatible + - interrupts + + additionalProperties: false + + pwrkey: + type: object + $ref: /schemas/input/input.yaml# + + properties: + compatible: + const: nxp,bbnsm-pwrkey + + interrupts: + maxItems: 1 + + linux,code: true + + required: + - compatible + - interrupts + + additionalProperties: false + +required: + - compatible + - reg + - rtc + - pwrkey + +additionalProperties: false + +examples: + - | + #include + #include + + bbnsm: bbnsm@44440000 { + compatible = "nxp,bbnsm", "syscon", "simple-mfd"; + reg = <0x44440000 0x10000>; + + bbnsm_rtc: rtc { + compatible = "nxp,bbnsm-rtc"; + interrupts = ; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,bbnsm-pwrkey"; + interrupts = ; + linux,code = ; + }; + }; From patchwork Tue Jan 3 07:47:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13087283 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 9AEF5C3DA7D for ; Tue, 3 Jan 2023 07:49:05 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pKJUwFWgXTrJhRiGdMWc2EiibCFzmzjnCtGz5RfjESs=; b=R4vTlmgGYrChfr XkFAZQdrERwGYwCNy27cwvtS4CyKZqlmo3hsjPSt5qJLkQyjxQTDcJ6LYE5/SbByfeuqgGB9yF89h wsyGXr4PAvd52pzo+lVCZfKOlTvnk429ofydzg906m/tpitmZ69oBXa/5EPkC3sZLhEX4B/aaOHp0 zkW+fJfYLi4GrIr6CXzfeHnePK/EvHV3xx5bD+Nl06ajrH1s8gobvfx9S/6jkXCrqJmyYMf0xBObH b9PHo7CpZfQyZ4Uf6OPeAx7UYcVY+6MJrXiVrdH/10zffBqZ2Olkpj7QvzoOjTjFFrXrHHNHXxy+O YDFzpltoWjlquMFAxfwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCc1L-00HXWa-Dh; Tue, 03 Jan 2023 07:47:40 +0000 Received: from mail-db5eur01on2043.outbound.protection.outlook.com ([40.107.15.43] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCc0O-00HXAA-Fc for linux-arm-kernel@lists.infradead.org; Tue, 03 Jan 2023 07:46:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DeNRghVnwxJk9jhBtxdnJigo6Y6lHASXCeUrrxrHv+CGRtiPLmH4S68T+iFYtlhtu3GeUQeN+5Q8Ywkh0fwE+CpB67kw29iU9NtUkan6WWu9mok8WkM7/1pehWJ0C/YmJv8Xim9ZTwJDdk1bS5NRH0CwV5FKgXJE+ql6a4Aa/0qNiSomqwA43k13/meD1VAIlnISVvkxk15tgUKHqAiDax3PvqqWVrOr0jWAA+mTzQZTplMBITwY2L5mTPOCfJ3IcXB7n4XjaRQqzoASOvh2zhMeY3eyHSZ6gJkqjicK+Jcb5dIig3qb9EyamPpoUG0DBANbcVE9oI42BbqQLoCE8A== 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=qbq+1S/My0nG+foNSTCZdaBMPPvDkGM3ynEhyXEX1lQ=; b=jBJMqdUf4ghscEI6oxGjN2nxbBd+sF59BN79eYlvEW64ejJApEIFt8U7/lv5OqnsChFJgsxQpFE/qnBnxsc60EH6hkgVsGACq/VZzOB5cgNUXo1tuXKlGj7kE1nUWfsIvwete7EcaHQ+4Km6E5PhgTV8NhErTbpqDlU+7aXqbdev6ASEPGk7AJ2tNEW8FBO1eNziYQvOe57QokuCHBJrscUSYtdSkSjNM6lLPSL8tjivyxMb1nov3i7Z9T2S1YL8h72bu4ja5ObswxS434/Hl7jYcNLCAOaI9Bu3vWsgncv7HRKQvaQI7Dk9vh+3LEQ3/YrDTyRUXi/yp2jWO8iIPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qbq+1S/My0nG+foNSTCZdaBMPPvDkGM3ynEhyXEX1lQ=; b=Xtct89v4ORwe0d+l7T5xupe2imfbjRiYizGxsCAQAkNgegK+jfRm+AD7FX5pFD5Xh9yfX+Ponuzi/QBhaSn9aobvcGwfb3ulog4Nw6cU0kPU/qafVheG7eHezGWPPRFpd21uA7XmZ6RgobsDA6L15i4momZbjKJEFg9yiYTRZQQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) by VI1PR04MB6894.eurprd04.prod.outlook.com (2603:10a6:803:13a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 07:46:37 +0000 Received: from AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::286e:e16f:828f:f4ce]) by AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::286e:e16f:828f:f4ce%8]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 07:46:37 +0000 From: Jacky Bai To: lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, dmitry.torokhov@gmail.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-rtc@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, festevam@gmail.com Subject: [PATCH v3 2/4] input: bbnsm_pwrkey: Add bbnsm power key support Date: Tue, 3 Jan 2023 15:47:40 +0800 Message-Id: <20230103074742.2324924-3-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230103074742.2324924-1-ping.bai@nxp.com> References: <20230103074742.2324924-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:3:17::32) To AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8650:EE_|VI1PR04MB6894:EE_ X-MS-Office365-Filtering-Correlation-Id: ef5c0efb-66e0-459b-e00b-08daed5ea4f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CWJZp5r4tYrUK1Er9eZcO066Wu4TyK9oMwM6RRXRXoLXlZjzMpGEobb/Z18FEcbM7AA5EKRKlzNLEVKfJqADScL5/n6LGRsDlXcAY/HDl7Hlto1BqB+kpwNxB2HFSi8jZu08Gy+cAQD70kQxObE6lQs1xkfpTOqZSTVZWiPwW9xmIEn0yIUD9d1MIIuqg1ugXUeDA2KUx/D01EV9zUzfsbLAAJiipZif32uyVIAsOKxI2BMcMve9ayrq4JjApAgTegx4orkceoyzfNZkNseYcHFO3GcrpeyXtM5Zvz/WuMMXGDXUVI3MhbZpP2YcdCJFV0bLbLPxfTJJJCq5FS0jUxXdb404rTo4wylkAXQ6vjP8+769ylBkQVwWgk07rcIBos0Z3QSvvzxngxjljBx0e3f3z3sprMwYCp5hP4k16Ap4mKVjoaTpirLrlFSv3VHfa04saD+ja+b1bYU1kR+zPII16pNNMOLfOFqrKoR7ZAHJeO5jkito9/O6ln9DUCWTpVNLPg+6cBtrSm4s6w9x3RxZODju1l6E+r9Rugxdl4lBtnTutOMK/O7rlUIy3vITA9bvT9fFu3MJfqwcbDkpo07lv+bimtThfjWbJjBusXfCGgQSDT+IsbUig1gYy5RBBeMt3r6Z3hssEhHc/x+hBn5C5/RqAUYezujbTPOSRSPEvNNuPQYytxfudw57vlXHvmHBq+1T8GvrnPJJFKx7KTI3qqAEgykX33+p67kdcxE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8650.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(136003)(376002)(346002)(366004)(39860400002)(451199015)(8936002)(41300700001)(6666004)(2906002)(8676002)(38100700002)(66946007)(1076003)(38350700002)(7416002)(83380400001)(66476007)(5660300002)(66556008)(4326008)(186003)(478600001)(6512007)(26005)(2616005)(316002)(6486002)(52116002)(36756003)(6506007)(86362001)(22166006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: S1dXNIyNjZxo2nDjIvmbvM3C+3yVfrzl+W+55VKxLaiKajqfwjuBCL7GrwPTlNj1bQCQyRgGF6dCm0uYVSDgtNnet+Msgu4ffiM4GHQx6xLH4hAF5bIeoY5dw8JIjinnu3FWlVRGkamazcFC5r9Cx094/ZtnsVjL96wlGpRa9hliT1x6zjjOBSsg/ygBtwN4K/PRHdlEFXd4D/GzixmkvWvzahbiWlBEJ6ICnbahoEOV1CKsdmkP/UaSiwnbIs0GsxKVFdx6TryQ9ZaIvUKcNsYkrG75cutwK6CWiasd0hYs9hvyPsfoF/EzwVGmYKSXySIzXg7LbJDlxmxqz43JjprjqdQfIFyGnT4OqSJsRODDGBbaOOCkTa/Si0dp0hV1TL7ND0P0gafj0t5AxJ2/f503oggCWGN4OLhT3/WxkQKfPHrJD9vagfsUeuqWqA/SbTi0RSS0SgSF2zOi6fw4be7ovLMmlkNwfZRAFW0WB0Rf0M8oe175LRjsH9u8TMofmY8bIf8SBl00KjS969lsbdnYYOO+Ns/aaBUDcDrjcmzp8kgFYKZu2RXdpt5HIdOZcaz/zNiFzkj+KqbI7nUsMD1icWQ41MtJsOyPz4HqYAgqZ5nMxkHtOy1QwfdPQXcKuB/FOih7UfOUzYCi1U/BpbbUi5BZloZXl17CgBc+Nzcvma8zo1CkIDsdgeiOAn5lMGfoZfy/DzvIM7/LTXtgcjjlbTaRRmZyegPTYq8zjLpO2CHvitXjf9n5lsCsznm2LOSLTnHBixF6sVlEsIrha0NdmtMsLWK94B/VlvgSyvZ4fEvjJIE9Hp9SBIkJAVSwk1rg8JXo0VFJ+cEqTrLQSmBiz6NkUki/UnrW1GWDoS3qX0bQ0o/lRQXDGQRY8kb7nIvQfWoqSldfsT+rJADsdxEpoNBlRyDrIT+gInoCq/2ALXQdwXZcft2BecQDkaQxe/ULfrrFnw7Mofbytq/IwRmImlIzo/uxO30z/fXa+z/UU4x+BnXZa1n1pGVWaRUIw60jENAiQKqGSjCd6n3FxyTxJhtqnhl28YEYXkgTRLetc8mCHm/t6jJuwoUGkv0cy+FNeIOpoZlFqtM7+AdRqAodwW3odmgWp8dgaaCzyWn49ksptFWEMWenThdePDPhjVcIaAGWmBm9QiIv5GJHmm2Sjrk5sPmDFMpXGGVtiSwTFmo8CjFFa0U6iUdwoMRMDgQMHgsPpxKidKr9R6zBTkCSCtOKMU8jrvFC4t6GAYmgJFcQ36dPhR0oK+SoJ5U5F/CkOkYIyl9hpcZBOjCc23c9qGqofi9PlsTeV/An+BymsycBuQ9NEPxo4krgNaXgXCTazMNKT1Qns4lAtPpondDZPd92D9e0xLI12x0zTODodAtRDfTml1ipLdKTqJxSuWKTRZqIMf0rTdJdJGBsqv1IAdFSURnhAmioZPWetA0yyT1zgXv63hu7NSgHVsTgvtlS8/RliKCufugzHgSq1U+c1mvyyOdsAV236z3g//O6sCoyw3LiH2+hy1DjmK8ffCQK9Sqx+91iSkiCyqp8RWyBvYJggGWk0NBE689k27BF5jGwYVFLP4qaGE6HGF9X X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef5c0efb-66e0-459b-e00b-08daed5ea4f3 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8650.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 07:46:37.8375 (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: 9Odw5MPELLn0Jvhun389oMKM3MOGQSB5Vey5HDlJjZ4dNNEA6OC4MfY+4DP+n8choaN9Auw27imFC7HMpj0ejw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6894 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230102_234642_310070_8F6D9CBB X-CRM114-Status: GOOD ( 30.54 ) 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 The ON/OFF logic inside the BBNSM allows for connecting directly into a PMIC or other voltage regulator device. The module has an button input signal and a wakeup request input signal. It also has two interrupts (set_pwr_off_irq and set_pwr_on_irq) and an active-low PMIC enable (pmic_en_b) output. Add the power key support for the ON/OFF button function found in BBNSM module. Signed-off-by: Jacky Bai Reviewed-by: Peng Fan --- - v2 changes: - use device_property_read_u32() to read the property - clean up the goto return, return directly - sort the header file alphabetically - rename the file to add 'nxp' prefix - v3 changes: - get the regmap directly from the parent node --- drivers/input/keyboard/Kconfig | 11 ++ drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/nxp-bbnsm-pwrkey.c | 190 ++++++++++++++++++++++ 3 files changed, 202 insertions(+) create mode 100644 drivers/input/keyboard/nxp-bbnsm-pwrkey.c diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 84490915ae4d..43827e34f276 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -456,6 +456,17 @@ config KEYBOARD_SNVS_PWRKEY To compile this driver as a module, choose M here; the module will be called snvs_pwrkey. +config KEYBOARD_BBNSM_PWRKEY + tristate "NXP BBNSM Power Key Driver" + depends on ARCH_MXC || COMPILE_TEST + depends on OF + help + This is the bbnsm powerkey driver for the NXP i.MX application + processors. + + To compile this driver as a module, choose M here; the + module will be called bbnsm_pwrkey. + config KEYBOARD_IMX tristate "IMX keypad support" depends on ARCH_MXC || COMPILE_TEST diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 5f67196bb2c1..e34dd65a34c3 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o obj-$(CONFIG_KEYBOARD_APPLESPI) += applespi.o obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o +obj-$(CONFIG_KEYBOARD_BBNSM_PWRKEY) += nxp-bbnsm-pwrkey.o obj-$(CONFIG_KEYBOARD_BCM) += bcm-keypad.o obj-$(CONFIG_KEYBOARD_CAP11XX) += cap11xx.o obj-$(CONFIG_KEYBOARD_CLPS711X) += clps711x-keypad.o diff --git a/drivers/input/keyboard/nxp-bbnsm-pwrkey.c b/drivers/input/keyboard/nxp-bbnsm-pwrkey.c new file mode 100644 index 000000000000..dc937036c952 --- /dev/null +++ b/drivers/input/keyboard/nxp-bbnsm-pwrkey.c @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright 2022 NXP. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BBNSM_CTRL 0x8 +#define BBNSM_INT_EN 0x10 +#define BBNSM_EVENTS 0x14 +#define BBNSM_PAD_CTRL 0x24 + +#define BBNSM_BTN_PRESSED BIT(7) +#define BBNSM_PWR_ON BIT(6) +#define BBNSM_BTN_OFF BIT(5) +#define BBNSM_EMG_OFF BIT(4) +#define BBNSM_PWRKEY_EVENTS (BBNSM_PWR_ON | BBNSM_BTN_OFF | BBNSM_EMG_OFF) +#define BBNSM_DP_EN BIT(24) + +#define DEBOUNCE_TIME 30 +#define REPEAT_INTERVAL 60 + +struct bbnsm_pwrkey { + struct regmap *regmap; + int irq; + int keycode; + int keystate; /* 1:pressed */ + struct timer_list check_timer; + struct input_dev *input; +}; + +static void bbnsm_pwrkey_check_for_events(struct timer_list *t) +{ + struct bbnsm_pwrkey *bbnsm = from_timer(bbnsm, t, check_timer); + struct input_dev *input = bbnsm->input; + u32 state; + + regmap_read(bbnsm->regmap, BBNSM_EVENTS, &state); + + state = state & BBNSM_BTN_PRESSED ? 1 : 0; + + /* only report new event if status changed */ + if (state ^ bbnsm->keystate) { + bbnsm->keystate = state; + input_event(input, EV_KEY, bbnsm->keycode, state); + input_sync(input); + pm_relax(bbnsm->input->dev.parent); + } + + /* repeat check if pressed long */ + if (state) { + mod_timer(&bbnsm->check_timer, + jiffies + msecs_to_jiffies(REPEAT_INTERVAL)); + } +} + +static irqreturn_t bbnsm_pwrkey_interrupt(int irq, void *dev_id) +{ + struct platform_device *pdev = dev_id; + struct bbnsm_pwrkey *bbnsm = platform_get_drvdata(pdev); + struct input_dev *input = bbnsm->input; + u32 event; + + regmap_read(bbnsm->regmap, BBNSM_EVENTS, &event); + if (event & BBNSM_BTN_OFF) + mod_timer(&bbnsm->check_timer, jiffies + msecs_to_jiffies(DEBOUNCE_TIME)); + else + return IRQ_NONE; + + pm_wakeup_event(input->dev.parent, 0); + + /* clear PWR OFF */ + regmap_write(bbnsm->regmap, BBNSM_EVENTS, BBNSM_BTN_OFF); + + return IRQ_HANDLED; +} + +static void bbnsm_pwrkey_act(void *pdata) +{ + struct bbnsm_pwrkey *bbnsm = pdata; + + del_timer_sync(&bbnsm->check_timer); +} + +static int bbnsm_pwrkey_probe(struct platform_device *pdev) +{ + struct bbnsm_pwrkey *bbnsm; + struct input_dev *input; + struct device_node *np = pdev->dev.of_node; + int error; + + bbnsm = devm_kzalloc(&pdev->dev, sizeof(*bbnsm), GFP_KERNEL); + if (!bbnsm) + return -ENOMEM; + + bbnsm->regmap = syscon_node_to_regmap(np->parent); + if (IS_ERR(bbnsm->regmap)) { + dev_err(&pdev->dev, "bbnsm pwerkey get regmap failed\n"); + return PTR_ERR(bbnsm->regmap); + } + + if (of_property_read_u32(np, "linux,code", &bbnsm->keycode)) { + bbnsm->keycode = KEY_POWER; + dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n"); + } + + bbnsm->irq = platform_get_irq(pdev, 0); + if (bbnsm->irq < 0) + return -EINVAL; + + /* config the BBNSM power related register */ + regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, BBNSM_DP_EN, BBNSM_DP_EN); + + /* clear the unexpected interrupt before driver ready */ + regmap_write_bits(bbnsm->regmap, BBNSM_EVENTS, BBNSM_PWRKEY_EVENTS, BBNSM_PWRKEY_EVENTS); + + timer_setup(&bbnsm->check_timer, bbnsm_pwrkey_check_for_events, 0); + + input = devm_input_allocate_device(&pdev->dev); + if (!input) { + dev_err(&pdev->dev, "failed to allocate the input device\n"); + return -ENOMEM; + } + + input->name = pdev->name; + input->phys = "bbnsm-pwrkey/input0"; + input->id.bustype = BUS_HOST; + + input_set_capability(input, EV_KEY, bbnsm->keycode); + + /* input customer action to cancel release timer */ + error = devm_add_action(&pdev->dev, bbnsm_pwrkey_act, bbnsm); + if (error) { + dev_err(&pdev->dev, "failed to register remove action\n"); + return error; + } + + bbnsm->input = input; + platform_set_drvdata(pdev, bbnsm); + + error = devm_request_irq(&pdev->dev, bbnsm->irq, bbnsm_pwrkey_interrupt, + IRQF_SHARED, pdev->name, pdev); + if (error) { + dev_err(&pdev->dev, "interrupt not available.\n"); + return error; + } + + error = input_register_device(input); + if (error < 0) { + dev_err(&pdev->dev, "failed to register input device\n"); + return error; + } + + device_init_wakeup(&pdev->dev, true); + dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq); + + return 0; +} + +static const struct of_device_id bbnsm_pwrkey_ids[] = { + { .compatible = "nxp,bbnsm-pwrkey" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, bbnsm_pwrkey_ids); + +static struct platform_driver bbnsm_pwrkey_driver = { + .driver = { + .name = "bbnsm_pwrkey", + .of_match_table = bbnsm_pwrkey_ids, + }, + .probe = bbnsm_pwrkey_probe, +}; +module_platform_driver(bbnsm_pwrkey_driver); + +MODULE_AUTHOR("Jacky Bai "); +MODULE_DESCRIPTION("NXP bbnsm power key Driver"); +MODULE_LICENSE("GPL"); From patchwork Tue Jan 3 07:47:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13087284 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 D80B9C54EBD for ; Tue, 3 Jan 2023 07:49:48 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RlDHzJ+6IUnmSmXKFaa5bYWsB8QfliqkIdo2sMbS8Hs=; b=lLx1zvbuBPRFHU P0Pt7HIWLD59ejnUVBBHkX7oHx2q3uqRKNysS/y7kkWthKH3T3ij+nUtCjS1sd76ewoF/l3veufdX hvI5CgDcvV5T7ykREklTqFoSjmEZIkqPt3ovCR1NCwKmfqMFJt28ZP6q82BEG5m++AawgbxMl4ppd FXUOZVa2ckUBUk1SnvNA9Bba14VRWZyCMRAtLKZR4GLQjV2assKI6yx8hdYxzCAFnx/g8c+vwUSAN pTIGiZpyoqvA3b5oZSxHeCPDN3Z6kbVYhRMlC6CwLB2wFpuU/WmkMh3V9pprqETHDvuuXz1tGUC+5 Www8K1xeJp1UWpIQaffQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCc21-00HXoD-R7; Tue, 03 Jan 2023 07:48:23 +0000 Received: from mail-db5eur01on2043.outbound.protection.outlook.com ([40.107.15.43] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCc0W-00HXAA-S4 for linux-arm-kernel@lists.infradead.org; Tue, 03 Jan 2023 07:46:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HkyKHDcQSc82sl2gv9+/1pavceOUaxswbE1rDtiSqXWliLagytZllkZBOVFY8uPkCSKJG3iR2dDAO9BYIb+DH0dBrXkSa/hiylD0yk0Q5+56XrHdjfUNfYEEI6tRpeBR1z6tcL05Snr2ETu60Pc2Q4i7r4E9KDxc9ENvcGkOMWZ6mb7kcCN2WXEynBw2P3sq+vCzNc6NOugt9I13s2nMjuEUaGPKKWA/PwyVE1mIxBH9dGuQTEoJIZtXaTgnXR23bLlRjk/qivTNijbSXdRCBYLNc/OkFYDDM09TwQzFw2W2emtC87mzuHx7xrvlBkZX4dEMJxGCXu9mt92tNw0iWg== 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=bPmW5jEtR3yiiG7i5iwd4O53CG7/MlqzIZGn3troHEU=; b=i+rWTnc2SEaR5qPcMWjdgoWgyRfgouWbYyxiK+urJRuDu4Tv6fxDLL0WjcGOllDaBz3bX8gUTAq6qj3pmBX696BLL/Q0BrgRLWQgRfkbqGdpPStzEZMuPmD58C0Hwc94cJRx3ih7u7pO3ce/pdInQPDynqastDBJl0crPbfPV+lagxjIum6r0hkGNWMG40C5dXrvfgF4krq3OTZjbk0Omdu/NSG/y8+aNGEv+ypGVEi+2+W50RheOBUAGYoNGbVRv8HxLpQNJC/IT9mqK6npNAojtqwePLLY7Sd4In3FcqfHjtNRxFHnYhZInj6uNniC5VPN/F8OZuMFH/PFFMEK0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bPmW5jEtR3yiiG7i5iwd4O53CG7/MlqzIZGn3troHEU=; b=i9CeyFHTjzqrZsn1D35WZsPesJ7ZcwiLtKkyS6Su1PlLFvnlg2aueicW3/FBsaE5UpmY2pSe0ucjj2w8Zc7QPhkDp/HRSbnHRrrJwlt3J38t2JMUINb3SJM+6JxT85TgN2u8yRthEp6D7IIeB6e7jJk6BAhP6g52OEqVHqh8bY4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) by VI1PR04MB6894.eurprd04.prod.outlook.com (2603:10a6:803:13a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 07:46:43 +0000 Received: from AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::286e:e16f:828f:f4ce]) by AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::286e:e16f:828f:f4ce%8]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 07:46:43 +0000 From: Jacky Bai To: lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, dmitry.torokhov@gmail.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-rtc@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, festevam@gmail.com Subject: [PATCH v3 3/4] rtc: bbnsm: Add the bbnsm rtc support Date: Tue, 3 Jan 2023 15:47:41 +0800 Message-Id: <20230103074742.2324924-4-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230103074742.2324924-1-ping.bai@nxp.com> References: <20230103074742.2324924-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:3:17::32) To AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8650:EE_|VI1PR04MB6894:EE_ X-MS-Office365-Filtering-Correlation-Id: 81829650-5be5-4627-dcc6-08daed5ea849 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UaesgLMNa3G4rzUTs/JySiyX8w/P6qqYdIYAkK1PJZGaE6WfxP89YwvzEkAptGRD7T5pzFbV57ZUmVyWurSBKe94mov/JEMqunyv9VzSmmw07nfp6Q9Zbmz98xbBF6aVrT4Ki9vd0wYrZIz20iTsOLErKCBsNPr/FjO6yqgtQd/gjI68yhmq4HbFfkmKOcEykOek+iixS7mF1FuVh70Z0x9FCb2F51mTUx5NQ7iFLQH3gILssZmw0Hl+E6uGeZCePi/Dbvd3msytvFDcggZ5jFtYc62CLdbTEk3kuNc1juCchY7/a+Xq6e7jjtNZa3ZgPMoPZo3G07ahhnlDl4SEVVhcMeCKb+YoGankN0FYZYE5qcLhYGiqOZ0swp/Rv3rJ2h5Udo8GkOFxd4a3VcnY8/suU0uNDzsNpPa9kYnTV4zLvUu+njceUcruVvcIreUVfcdruPiEcRwT9fb6y6ZejK/gnWS2nuJDbS3jyAnoHsTKf7DuG2upDcl4niEbaVZzF2hKKvsQLnxtuKp7UPBuN6eBZyN8HHoFsjj36i8hMj4CiUzZeaE3t1gW1ND935M/LklOD8s8iwjbKP1R6BEUjiRzghq/l7FHU612wetz53DHydB5pz+e4znXHYnnd9u7Aeedw8RI0BVX6JIUa84W9xwnbWhy2vWCkg+6IHZ0K40zLzR42qZMVE/lD+AFJH0eEBPxi9+z81eAd1+GMBFwfrDFQ4IjzlvebuQlUaU+wdk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8650.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(136003)(376002)(346002)(366004)(39860400002)(451199015)(8936002)(41300700001)(2906002)(8676002)(38100700002)(66946007)(1076003)(38350700002)(7416002)(83380400001)(66476007)(5660300002)(66556008)(4326008)(186003)(478600001)(6512007)(26005)(2616005)(316002)(6486002)(52116002)(36756003)(6506007)(86362001)(22166006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X7rQ/QuA8kixEDEH/kCjULKCEwikGKdDqBh6OnPcaX3VdzCxOFywVzqnRioAxsOw9F6JvKOPtxxDa1ILqpF7LPh9o2U5kAe0CYHOkklPlJUoxPwvocg+slZH0MuLTf1Q9hy6XAWMfR9TtfkSguiM3U5gcBFup0euZ6KSF62xCQ0bj8oFTi4sC1Jz75hu7GJuTWNEZtNajaUazAZgE02JgllnrR3p5O894CrtppXS25FL9osG0khVA2TJifB4GtKjSyAvumuwqwpv0a0mpbncns9NW6L2dUYVP0z6q/5hNE/vQ4VhPzeFDFdH62ikgDDnZ2KFnm1Sc6QFRbIx1v6hQ9wqMoQSvPeASNbqJca1HTvWLA/D43y7acH9N4fJVUND34uppThfQx4lIMP4g+7MfyQkpL/l7PGmt3KjsaUNDIHx+OHbbJiyEBcYn82tOtRCe303g4SxmGi6vAsAYLG385Ul8WPEHhZwO8eteBmvqIB48p3+eZ+Rib10XjwCoh4mbJJYtHHnv3SzaKH5SBJQH0nkIbjiOYxmI7MAWqk8mWAqAl2bPcr35yOYhXPYbH7gl/CjOdIuZFoZKhfXWpX+69/JwaSMiPZyEHLxMs0mo02gI77yuIs12wOH64xDlvA3ge/yIxT9HH4HiHbZaxBs2pjBD1WHXYl1saXiePSwPcZ+tyLbhjNttlMZ2M3pf0tun3tZXiIL6yhsfySGDJwInFQ5EXokX+jMy2UERJRnxYfVaXlstv3GdDB3gaUTwLDCTzAklBO9gCfM8HXy+ckDegKMP31lKQmdgC7QKQSeszqHr3lrAFWF2A2lO02Re4WUk5m2X+UsGWpMxUQCFlAfnVj3AdFuXsm1ouHNGuaaeiS4TARmB5i4xn0iMZ+FEXnt/nb+oRg8tIFdcBRYH4uKOsWrqLlg6ms67QeMjPdYfz3tbJKFaA0Vp0038f/xyF/AKs4vTKlCW27o/L4TzSqYWTSWIqzL5fp9VyulVxEAFN8FukPeJihwc3QmNk5Cng1n7znE+1G9M9A7YINuQPb1J6XwUmSFfwEYejgHfAtfLPHLTxNKEswWK17mfyJammzvrzhLDFDRVH5P3oZXVeGx3mhtTrn6beyWmh7qwSg1Oy/krRhYxPzBmJOcVCv7j/BSnaNH6SQpvvpN/Kh0ajxtMksbqkhAUsrJkOH0wWFc+dOL0qKnIo/5/XCroOQZnjpMDoHkSxiWIJy3oVIAogLzNmAwjbUTvCZSYLyoPL1O1jfDN/+LsT457DjgX0jLRp1011X5FHqoqewfLHNHmr8Xfw9+2U3gL3umXAJAFlyHaU8NCx0qcUAWnpPkryN4URQC9VYBhAafmUvr/laMrNfQ05Htoji17VcWcXkIjF0/ur+tYyzABSHv8z7wBJ4Ky7OUiTZZnjR/tXbOc1yaX2a9s424WyIGszSFcnlfzZ38sg0qAGZ+MFRCeMaXdxQF0BvtqwwyX+BQP0Auuj61sw0i6QbD/HXQ8zvPantlbKiAnmdeoAFciC9HWsGupw/NvTLnZ5Ttc8qROVxojD6aInZNUurQR80woOynOqPmCgCaEaTIAzaoXz0ZZUbpESBUPDL0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81829650-5be5-4627-dcc6-08daed5ea849 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8650.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 07:46:43.5436 (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: hdmCqbE6u5lidDpL0trg8rGgmaGa12/VvmkB+JwyxV7gU7IAFyLFXOTFFGYCBkO2Najg0gsuwQlpd5+XozXhvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6894 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230102_234648_980963_EE8AB517 X-CRM114-Status: GOOD ( 28.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 The BBNSM module includes a real time counter with alarm. Add a RTC driver for this function. Signed-off-by: Jacky Bai Reviewed-by: Peng Fan --- - v2 changes: - sort the header file alphabetically - rename the file to add 'nxp' prefix - refine bbnsm_rtc_irq_handler function, remove the unnecessary event variable - add rtc enable check in .read_time, remove rtc enable in probe function - remove unnecessary dev_err log in probe function - v3 changes: - get the regmap directly from parent node - remove unnecessary dev_err log print --- drivers/rtc/Kconfig | 12 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-nxp-bbnsm.c | 226 ++++++++++++++++++++++++++++++++++++ 3 files changed, 239 insertions(+) create mode 100644 drivers/rtc/rtc-nxp-bbnsm.c diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 677d2601d305..1b9e8395d118 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1786,6 +1786,18 @@ config RTC_DRV_SNVS This driver can also be built as a module, if so, the module will be called "rtc-snvs". +config RTC_DRV_BBNSM + tristate "NXP BBNSM RTC support" + select REGMAP_MMIO + depends on ARCH_MXC || COMPILE_TEST + depends on HAS_IOMEM + depends on OF + help + If you say yes here you get support for the NXP BBNSM RTC module. + + This driver can also be built as a module, if so, the module + will be called "rtc-bbnsm". + config RTC_DRV_IMX_SC depends on IMX_SCU depends on HAVE_ARM_SMCCC diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index d3c042dcbc73..0f11027a7388 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -33,6 +33,7 @@ obj-$(CONFIG_RTC_DRV_ASPEED) += rtc-aspeed.o obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o obj-$(CONFIG_RTC_DRV_AT91SAM9) += rtc-at91sam9.o obj-$(CONFIG_RTC_DRV_AU1XXX) += rtc-au1xxx.o +obj-$(CONFIG_RTC_DRV_BBNSM) += rtc-nxp-bbnsm.o obj-$(CONFIG_RTC_DRV_BD70528) += rtc-bd70528.o obj-$(CONFIG_RTC_DRV_BQ32K) += rtc-bq32k.o obj-$(CONFIG_RTC_DRV_BQ4802) += rtc-bq4802.o diff --git a/drivers/rtc/rtc-nxp-bbnsm.c b/drivers/rtc/rtc-nxp-bbnsm.c new file mode 100644 index 000000000000..fd7046695d01 --- /dev/null +++ b/drivers/rtc/rtc-nxp-bbnsm.c @@ -0,0 +1,226 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright 2022 NXP. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BBNSM_CTRL 0x8 +#define BBNSM_INT_EN 0x10 +#define BBNSM_EVENTS 0x14 +#define BBNSM_RTC_LS 0x40 +#define BBNSM_RTC_MS 0x44 +#define BBNSM_TA 0x50 + +#define RTC_EN 0x2 +#define RTC_EN_MSK 0x3 +#define TA_EN (0x2 << 2) +#define TA_DIS (0x1 << 2) +#define TA_EN_MSK (0x3 << 2) +#define RTC_INT_EN 0x2 +#define TA_INT_EN (0x2 << 2) + +#define BBNSM_EVENT_TA (0x2 << 2) + +#define CNTR_TO_SECS_SH 15 + +struct bbnsm_rtc { + struct rtc_device *rtc; + struct regmap *regmap; + int irq; + struct clk *clk; +}; + +static u32 bbnsm_read_counter(struct bbnsm_rtc *bbnsm) +{ + u32 rtc_msb, rtc_lsb; + unsigned int timeout = 100; + u32 time; + u32 tmp = 0; + + do { + time = tmp; + /* read the msb */ + regmap_read(bbnsm->regmap, BBNSM_RTC_MS, &rtc_msb); + /* read the lsb */ + regmap_read(bbnsm->regmap, BBNSM_RTC_LS, &rtc_lsb); + /* convert to seconds */ + tmp = (rtc_msb << 17) | (rtc_lsb >> 15); + } while (tmp != time && --timeout); + + return time; +} + +static int bbnsm_rtc_read_time(struct device *dev, struct rtc_time *tm) +{ + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + unsigned long time; + u32 val; + + regmap_read(bbnsm->regmap, BBNSM_CTRL, &val); + if ((val & RTC_EN_MSK) != RTC_EN) + return -EINVAL; + + time = bbnsm_read_counter(bbnsm); + rtc_time64_to_tm(time, tm); + + return 0; +} + +static int bbnsm_rtc_set_time(struct device *dev, struct rtc_time *tm) +{ + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + unsigned long time = rtc_tm_to_time64(tm); + + /* disable the RTC first */ + regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, RTC_EN_MSK, 0); + + /* write the 32bit sec time to 47 bit timer counter, leaving 15 LSBs blank */ + regmap_write(bbnsm->regmap, BBNSM_RTC_LS, time << CNTR_TO_SECS_SH); + regmap_write(bbnsm->regmap, BBNSM_RTC_MS, time >> (32 - CNTR_TO_SECS_SH)); + + /* Enable the RTC again */ + regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, RTC_EN_MSK, RTC_EN); + + return 0; +} + +static int bbnsm_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) +{ + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + u32 bbnsm_events, bbnsm_ta; + + regmap_read(bbnsm->regmap, BBNSM_TA, &bbnsm_ta); + rtc_time64_to_tm(bbnsm_ta, &alrm->time); + + regmap_read(bbnsm->regmap, BBNSM_EVENTS, &bbnsm_events); + alrm->pending = (bbnsm_events & BBNSM_EVENT_TA) ? 1 : 0; + + return 0; +} + +static int bbnsm_rtc_alarm_irq_enable(struct device *dev, unsigned int enable) +{ + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + + /* enable the alarm event */ + regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, TA_EN_MSK, enable ? TA_EN : TA_DIS); + /* enable the alarm interrupt */ + regmap_update_bits(bbnsm->regmap, BBNSM_INT_EN, TA_EN_MSK, enable ? TA_EN : TA_DIS); + + return 0; +} + +static int bbnsm_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) +{ + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + unsigned long time = rtc_tm_to_time64(&alrm->time); + + /* disable the alarm */ + regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, TA_EN, TA_EN); + + /* write the seconds to TA */ + regmap_write(bbnsm->regmap, BBNSM_TA, time); + + return bbnsm_rtc_alarm_irq_enable(dev, alrm->enabled); +} + +static const struct rtc_class_ops bbnsm_rtc_ops = { + .read_time = bbnsm_rtc_read_time, + .set_time = bbnsm_rtc_set_time, + .read_alarm = bbnsm_rtc_read_alarm, + .set_alarm = bbnsm_rtc_set_alarm, + .alarm_irq_enable = bbnsm_rtc_alarm_irq_enable, +}; + +static irqreturn_t bbnsm_rtc_irq_handler(int irq, void *dev_id) +{ + struct device *dev = dev_id; + struct bbnsm_rtc *bbnsm = dev_get_drvdata(dev); + u32 val; + + regmap_read(bbnsm->regmap, BBNSM_EVENTS, &val); + if (val & BBNSM_EVENT_TA) { + bbnsm_rtc_alarm_irq_enable(dev, false); + /* clear the alarm event */ + regmap_write_bits(bbnsm->regmap, BBNSM_EVENTS, TA_EN_MSK, BBNSM_EVENT_TA); + rtc_update_irq(bbnsm->rtc, 1, RTC_AF | RTC_IRQF); + + return IRQ_HANDLED; + } + + return IRQ_NONE; +} + +static int bbnsm_rtc_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct bbnsm_rtc *bbnsm; + int ret; + + bbnsm = devm_kzalloc(&pdev->dev, sizeof(*bbnsm), GFP_KERNEL); + if (!bbnsm) + return -ENOMEM; + + bbnsm->rtc = devm_rtc_allocate_device(&pdev->dev); + if (IS_ERR(bbnsm->rtc)) + return PTR_ERR(bbnsm->rtc); + + bbnsm->regmap = syscon_node_to_regmap(np->parent); + if (IS_ERR(bbnsm->regmap)) { + dev_dbg(&pdev->dev, "bbnsm get regmap failed\n"); + return PTR_ERR(bbnsm->regmap); + } + + bbnsm->irq = platform_get_irq(pdev, 0); + if (bbnsm->irq < 0) + return bbnsm->irq; + + platform_set_drvdata(pdev, bbnsm); + + /* clear all the pending events */ + regmap_write(bbnsm->regmap, BBNSM_EVENTS, 0x7A); + + device_init_wakeup(&pdev->dev, true); + dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq); + + ret = devm_request_irq(&pdev->dev, bbnsm->irq, bbnsm_rtc_irq_handler, + IRQF_SHARED, "rtc alarm", &pdev->dev); + if (ret) { + dev_err(&pdev->dev, "failed to request irq %d: %d\n", + bbnsm->irq, ret); + return ret; + } + + bbnsm->rtc->ops = &bbnsm_rtc_ops; + bbnsm->rtc->range_max = U32_MAX; + + return devm_rtc_register_device(bbnsm->rtc); +} + +static const struct of_device_id bbnsm_dt_ids[] = { + { .compatible = "nxp,bbnsm-rtc", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, bbnsm_dt_ids); + +static struct platform_driver bbnsm_rtc_driver = { + .driver = { + .name = "bbnsm_rtc", + .of_match_table = bbnsm_dt_ids, + }, + .probe = bbnsm_rtc_probe, +}; +module_platform_driver(bbnsm_rtc_driver); + +MODULE_AUTHOR("Jacky Bai "); +MODULE_DESCRIPTION("NXP BBNSM RTC Driver"); +MODULE_LICENSE("GPL"); From patchwork Tue Jan 3 07:47:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13087292 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 02782C3DA7D for ; Tue, 3 Jan 2023 07:50:58 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tmYdpmHzREWbGtjctFziW5hUIh8KsNZykdPPIvXaBP8=; b=U7cVD93IbRP220 lvrGLzJ6dixw+dQYkUwihEUcrfMWqL7Hnb+xRxeYdyDFsPw6T6GBEeHfCGEYyMV1tj9uP6YqD3jSX 5r9vZ416yq2KDq6YypTLv8YEj82QCJv6/+Xb7FLiRS/xQQbGLsUxIqlhBncfiFjnmCmbCWI0uSrpB J4f0PfzrVzuQNvcNnIU1qCUuARIFWUitmrl2oKQA7XZAO/JElEODsDWNyhXXXNAoAp1T7tyQ/wngO nnsxQLiog9eENDCHVbkcDjaSm7aifWEu3FSRpJ4+C1c51auNHaBdYESLdQ1KzPK13ytoywfTVEenA 8ycZ3pq4Io2iMRX5bNWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCc32-00HYKk-0w; Tue, 03 Jan 2023 07:49:25 +0000 Received: from mail-db5eur01on2043.outbound.protection.outlook.com ([40.107.15.43] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCc0Z-00HXAA-9N for linux-arm-kernel@lists.infradead.org; Tue, 03 Jan 2023 07:46:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jSn3i1wyavlqmMlsAhURTLShnqzyKx048gtkyA9cmkEwALT3hH5PNrpLLqCyNXDhoC2zV5IENvCNGuuLmiXOocG8w039Cg6+pqv9fQ/Q5VVamZ3xDc3KmZApviTJO+bQm5Mq4zUXQPouL94j4+9XqUo1cvBWFZyW5AIkJ4fmKNnqgp3+KD7e0oLiGPxKzlkgnduzutfQ2F1GiVGQYQCUCxkRcORISGOqPxkVCi9CCpvs/vSsBp9FHgVN/swcQI6pFq7KZywbOESejtKoPmEuZVPehQJsDdrZGIwetWzpTLk1KwTQaR6JJAhdpiG2JLwjV+7UyBnPDXbQ9eGRt9BsrA== 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=MNlQVwb74W5iMtsoxgWGgPRcmkQt8vMxbn60Ftt5VJQ=; b=mRw8kJp5IodycpDGNO4vhlbBtGAvm7rGVD2YHSoaA8/2MUxg6en4RppHOLxP9BFHNkSwXZV8crxBQcQNOsjNWMoNqFPS1xjC+bNtnBvUwZqg5Wan5yLmO1CwNdfSBHZm+aejhNxyTO6KYcyvw441RfzN5lGUJPbvYk7jpCoNv6qR6+j3hsE+BjdwpzR8W8P+J+VpB2z6rTQ3jcVQWDJbXH1/usq5s/zR+vpbP8mqBtBF60WWCPgk2O6DrWiCCcSUSPBu30+K7tw1Rkx/rwajw5WT9pZI62zL2jSvRADTTzXQH+A26YsNnw4/k4BwPU7SZvpzgW1Ze+MNwVUKDWHFBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MNlQVwb74W5iMtsoxgWGgPRcmkQt8vMxbn60Ftt5VJQ=; b=W9B5DIgW1owjlIL85YMxU/2bKaKLcVc5nWolIMSm/4koi8+JF7JBw6zPf8VIGL4rrBf25RvGzvo8bphvrrVIqgaqTVV77qs10WsA3c6S+zh7B7RaXDKDE2SV4QlDQLYiZ/U8OU+37ojqhMnUsA/J8PnziEiT2CxXK4qEt7JEZZY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) by VI1PR04MB6894.eurprd04.prod.outlook.com (2603:10a6:803:13a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 07:46:49 +0000 Received: from AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::286e:e16f:828f:f4ce]) by AM9PR04MB8650.eurprd04.prod.outlook.com ([fe80::286e:e16f:828f:f4ce%8]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 07:46:49 +0000 From: Jacky Bai To: lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, dmitry.torokhov@gmail.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-rtc@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, festevam@gmail.com Subject: [PATCH v3 4/4] arm64: dts: imx93: Add the bbnsm dts node Date: Tue, 3 Jan 2023 15:47:42 +0800 Message-Id: <20230103074742.2324924-5-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230103074742.2324924-1-ping.bai@nxp.com> References: <20230103074742.2324924-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:3:17::32) To AM9PR04MB8650.eurprd04.prod.outlook.com (2603:10a6:20b:43d::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8650:EE_|VI1PR04MB6894:EE_ X-MS-Office365-Filtering-Correlation-Id: 501982b5-00d8-4c35-489b-08daed5eab9a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TzLB1CUM2kAUpPYKzY7Q4PKI/PSYplQT4WhhbEnRk8KWaAA3LmT+2oQGDaYf2MQH4JTXj4aa4+dKVjLfjc34nqeFTIWw91D9ZYNujOqtbF6Xqwk8QmITV3IyP/J7CaKfWRKxXIepsMquVrqx7QQXxMCtr8IBB3eDKWfmZmRhmEn1WJFZTbZ/aRxsEjd5v9TXh1ou4L+44cyROXkRDl0gYEJiyrLHAWEohDOGW7ZwlEj84j1Z8QEwU720fpieSqIKwNeHdy2pd+Lnlb2qJKNAiDH6gzZ1ZGmHr6g5cBePPiaYpLrZhk18ow2qC3W+28PD2LG5qYeN6DrBIQKJ7yQufjRHEhRhClT920cFGaHhUSvAjkoMdXgGr0xuOQyrDYPmfPwquXakKI/wHnmEeZfqORb1iAKtVylbeHzkNX9TJm59O2FRiAza+XqMhkt+WaUfUGkihfw4otiofhr7lTDqnurVGdIJHx7gUWKudDsa9AropQl1Ts0xWzTTWOlK8qYpg+Hpt7/mqPjdZGGdr/qEEz/WJ6Yzl8RpiLKywr59gWf0w5IyVcwEDaEf8zkIqpzqbEX3CQWb6Kca3FFW8taDGnPFfc4FqdG+Gzp/Z4TMMPH1RrOh5Gnz+LvPtH5UpL3WoQw9Egmc7bGDlGorlfy6QFMuV5Ku/Jab/Qi1/JXFNWPk5GMsz1cgz8yt2m74pZ0dYTbWCQ5SO0eW3lrzD0vahKcqj2S1ypKevPyFxNGiQOI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8650.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(136003)(376002)(346002)(366004)(39860400002)(451199015)(8936002)(41300700001)(6666004)(2906002)(8676002)(38100700002)(66946007)(1076003)(38350700002)(7416002)(83380400001)(66476007)(5660300002)(66556008)(4326008)(186003)(478600001)(6512007)(26005)(2616005)(316002)(6486002)(52116002)(36756003)(6506007)(86362001)(22166006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Eo5EPRFQHm65OiFmOgxIkOXynnLQ1wb9OzdwPzFyLI0hYIaVsPx5upczDT9+DzL2fOSfPuxTKQubqilC/ycEGhnvrVVKncPIhj9tsnyYRIxo8Z4Z5t4xkh2vuXxbvinqCDqEXkF54Lm6YRMZWZmJBBe8Ia1Mb67lM844hJ67rAkXiKeh8V/MFcluK9kSTQMYlMwOhSxBnVEKx5aZWfmJ9RgFhxLzvgcPNYFyVo+icAUCb5muaF9jZvtWrKS9DHXapQPRAVB17BH0y7ql5gZWtOB/iuolrXFyt1yW55UigNgWudPu6U8iY/9/7ZznIOWraGRLTcQUKPi5UHb6/YQWfU9tGqkNwiyAhJk77gn/ciriWZDfqjWmcz7C9Xs48vHD6Zr4relbx1pefv5EOG9zHEZHrmVC5sAH3cL55fJOGl3xIUxvk+Z8VvwXZlnu6C7G2I3Zfv5pnCvu1PDOmb9JQjZXvYv1frNRYY4177PkdOBl8573RalRAuXfRvxZgkB8+8z6Shc/KD4eLpj5IUIObRz2J1Z5/ZSnNnBPwQWwrNoUgbHFoYEAaglqtj+sOQbb5/qsC8+P6rs7fxfv/kvPk8l2GoFxAhQpTpMwFOMtC+bBoIkfy76ipk3AC73AXxDiv6i8SbE3zm6rDkaBexAmOkP74iGnwT5hruwshOqmprQyr2dWINQ6s7Yo4i2Od0pOQFQ0nLqMGsBN1KG6AG1BNtf7vstpNpxveyYBMhrSSe9pSpHwFM5jWI6vOJdW0eWAiyrHi++K3sU6dx5B9NSS7DvSIvS2x8YXp2M2UE/PsB3dD4PGNeK2OJnqlmb1FOSaKS4GwtXdK0HYoGsOByvZ+/w/zoj0sGEyEw++GVCAFha0Dz83bYMg87ZuFNyWwT42TI42wcwvm0xjItiDjlIqUsk0p/lZnzLclFIm7238npW7tfFRKfLIedlKl4sNvRdqB9kHET+CUESkl6Il3BySDvCTs0WGjDgo7G9Npl55Sq4A0MYtsim5QqKs3beY2nhb5llB3VEOzuCGU0hbHGwdzhpUpLH7YaKUEaCAj2viYR9CIR+AaFA6RivPduXA8P9yk9oa9vn76fRoamLHROWRhR2FgCfL2fJz6d6pp5FBZ+dtU6zedi4twpgrId1u09g8+u3TWd2NOjY0LuaFVssaBQLiCton5xU6HP2TEdI6w9FWnx5OHhNLFtFfGycpps+usAIN9yxTIE3h0KiiEW1I/orc3IEWmfv2zvY0TbJafb4uYaXRwPYn26LiakgUaovqxAry6pcP6Y3o63XcZ4uP3dn5OFC9OIp9N2y9mXAZhUUrCFzr/04cyu/1zR2633hYVTr7+5vcFPlsdyMBTKVIj8IUD7p17XfQtOibBdHIoNhsyUiA4tHuufK2i13l/IkxiVU84hQ2ajBtHbsMLa+HofYiZmIgZMDL7EEgpkgij3CX3oMaht/TzX8ycHcGozYNbNKUwA72DXv9M8eryeymep2isO8ppInBN5mdKWy+qwPQMOK0Ezf9DLqb6bcz9t/cVFD6GMNP/dXr8maGvC+0oMYfSjopgQopYApVZgWOdXhoCnyBUD2s9WJwrfyDXt41 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 501982b5-00d8-4c35-489b-08daed5eab9a X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8650.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 07:46:49.1049 (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: lCklA6mxXmCn559d65CoY3WtE3UHueTg1UihoYs32AKUSbKeWDyIxBHt/91ic+7p5w3aEQpg2coupbiov8LUhA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6894 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230102_234651_416128_52A6643E X-CRM114-Status: GOOD ( 10.40 ) 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 Add the bbnsm node for RTC & ON/OFF button support Signed-off-by: Jacky Bai --- - v2 changes: - update the regmap property to align with binding doc - v3 changes: - remove 'nxp,bbnsm-regmap' property to align with binding doc --- arch/arm64/boot/dts/freescale/imx93.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi index 5d79663b3b84..bac3fdd0041e 100644 --- a/arch/arm64/boot/dts/freescale/imx93.dtsi +++ b/arch/arm64/boot/dts/freescale/imx93.dtsi @@ -229,6 +229,22 @@ iomuxc: pinctrl@443c0000 { status = "okay"; }; + bbnsm: bbnsm@44440000 { + compatible = "nxp,bbnsm", "syscon", "simple-mfd"; + reg = <0x44440000 0x10000>; + + bbnsm_rtc: rtc { + compatible = "nxp,bbnsm-rtc"; + interrupts = ; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,bbnsm-pwrkey"; + interrupts = ; + linux,code = ; + }; + }; + clk: clock-controller@44450000 { compatible = "fsl,imx93-ccm"; reg = <0x44450000 0x10000>;