From patchwork Mon Nov 21 06:51:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13050362 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 3ED04C433FE for ; Mon, 21 Nov 2022 06:52:31 +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=AS5g4srkz8ILGIJnhIhNcEc14zgW0TCNmzmW94M2Bmw=; b=yZVNuY3jPLnwG0 PLhOGXFEi+bM7IAUTM9gjGXDuNKUEFAJ7DM6zRzdjViVBV3SwEiSxVR1AaDpMLKs9F252oFdSY77W 74s3VJ6nM39Ce7jQkX14RLw29ujwmhAUizKUm5VgZxbHt+iH+J/q5N5QkD9Z6jyxKkl70mpCeRcdC X/StdQFYIKW2YyF4C1gw8dqAnbl9W9O53gnweCZ9yDWNt8CEHfaiAAX6K9r+A47Diq3JjFw8apryP DhVAOIC8bY2cU94l9vrWo55Qw1tiHJ3hEb0zx6AymmgD+AQi1bTt1UTza0RppRxZo2MKkm+FMLprJ NIRBX3vC1nzA35NZav/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ox0eB-00A0MH-Er; Mon, 21 Nov 2022 06:51:16 +0000 Received: from mail-db8eur05on20626.outbound.protection.outlook.com ([2a01:111:f400:7e1a::626] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ox0dW-009zyN-PW for linux-arm-kernel@lists.infradead.org; Mon, 21 Nov 2022 06:50:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lVGmDp1EkVRRAXZ/LK7eID4jU6MRit4nGcEhTmhMRY5eHPjjeF7FAU7+2opFHkf7UMITg04kD6BDXOMIvSnxAsRJ8JB662ETHyHWHj0BVhY2Z6LFyULJAv6J3cxP3KlyIuOmDy/aTbXl9Xk839VzQLruiwKQtTdOJz+10bc3EEhTDNHwUx4kzLrRkIWG4HNRauQw3K3emPyalg3LNVjUH9lBTdNAOtG33qmbfi56cnYepjuwJEuI9YaqiKIRNd/7Jups5OKGGW2r/2r7sEzkuAVccv1RT7BEaS6M1GkbiSxD2vg/EKvgc9XcVJHjbctzIAxUWbFEZxnaBmee4tti+Q== 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=zAmeHWa2LC7fWrTzlRx7N0hL32CxrYHgfrWa3OU8q1A=; b=aUwx3k2cf3q/oEb+3NXJsu0GUw/iVxXq5EAJmphX+lseCh3G9trK+ilTcmt3EV/O8RTL8BSmbdE0BBqDhiFnrcQCd5Q7I0UGnvUfMwv78lPkKGNe79PRx320HNWwwPCwhpn5MvG0sdCVWBSRxpWN7Du/Bti61B1NiwUExYTlsHfmPTd9kyBGFWgoYQ8w70gRu3ZOe6G9TUhr4Tqp7ENtDAmHOmHFadb1XRNHqpvzk8Z1CbYKFDauAnhCELkV0ZMySBI0ydwKpVaujnepm3FWL4Ad01TFDs6Oy7414CN6/quNHuGxOe9RUbosiGuXIf9rvlxVJrDibXbJf1UsBFMXIQ== 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=zAmeHWa2LC7fWrTzlRx7N0hL32CxrYHgfrWa3OU8q1A=; b=TBqlAhTHPwxib0EbqtwRioAJg24VAWOrXKHMoVWKru3uBAwq1tIxtr7DEexVjdHAH2yjNlufPcbYD1goG6rFB833ly5Y19PLyEE7bh4VcSIwEBMrh85a6dpt1Wu5618MrXOJXzGgljksEsGP2H/e/TLWI4XtYHfm3P8olJQfASs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) by AM7PR04MB7142.eurprd04.prod.outlook.com (2603:10a6:20b:113::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.9; Mon, 21 Nov 2022 06:50:32 +0000 Received: from AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::9ded:65b7:9d51:d37a]) by AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::9ded:65b7:9d51:d37a%8]) with mapi id 15.20.5834.011; Mon, 21 Nov 2022 06:50: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 1/4] dt-bindings: mfd: nxp,bbnsm: Add binding for nxp bbnsm Date: Mon, 21 Nov 2022 14:51:41 +0800 Message-Id: <20221121065144.3667658-2-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221121065144.3667658-1-ping.bai@nxp.com> References: <20221121065144.3667658-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR02CA0123.apcprd02.prod.outlook.com (2603:1096:4:188::22) To AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8642:EE_|AM7PR04MB7142:EE_ X-MS-Office365-Filtering-Correlation-Id: 970c775f-e57f-483f-9dee-08dacb8caf68 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kyYTta+1umOFbyrbGu6RPwcTo4WpmHsYtEBXDCwamkrXcCiCa3RI+YAfDvlmRij0CnAoqbgn4DUO2ngJZtWhJIbnGwkw2RLNE8aKPeWBfvOt63hdiJgUIbRTrxk/rv/zqRBOA9lXn9aEdqipdXMnoS2SOn6unIbpObREYWyf8KrFt0OXb28SRI0O9KMbs+L72iG5JVRAJKKLv593t0pM42gtp5SzwtQzUdAlXiv8hu+bkgj4TCTv//2xMt4kLFPbjq38QshBsTih4quku+WQRH2UVkyurh3JytFp566vBaIXPJVG9ILKdJ98YDJKnsQOpGMMsoxwIyUem5Mmf93cHNsCv+tvmdGWgb3z2TATxpuaP1ZwtdVNWhDT1hMxQPt2JTmiGOpeJ3OylM867twaBBrzSnxf0h1kYVGmfEwQaQ9A3XFUZcK0/g9RSfhKJ3vivukbtSTsATIbsEobwmESV7T0ia1EVgfEjEnzT7xfZYHMxSEvqnOWHAsS//hdGZTibe+QfShnKWDIezG+cI0TmNg5D2QiTU3USZTptPGnlhskMXzhm6whoKYUTKgeNHhA8k69BCCk1wVBF45NFNbYUAYtQG5yzfnB7EV77D1lng6R10b6Wlhr7HeAZ/g9+3dx5jAwWr02RAvW5jhtzrVxxKAuaqUiOnQ+8Cj4qGRMNJXsSLc65yhL79tknhFw8IZuYf1jVUZihoGckL6htTy/A1BsRbwBy8A4DkkiPYw6wxa+E1BfDXnhTKujwTJB/WG1bGu4q8lnSFnpBDJMQusnLQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199015)(36756003)(38100700002)(38350700002)(41300700001)(2906002)(86362001)(66476007)(8676002)(4326008)(66556008)(316002)(6486002)(66946007)(6512007)(26005)(966005)(186003)(1076003)(8936002)(5660300002)(7416002)(478600001)(6506007)(2616005)(52116002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: apBW7VhEUNHkUGniVMqRTSl7/1h/qQ7Y3embo688qpUIfzvBDQ7Y5HS5zTLCpPgTo3AQ1qyy2YOa2s/JfwolPdDpP1VhqOSMnW8dsEX/edjhboJOpDm689RZYYPyjR6x67WcmCDyInSeyuhTx+ZaY9GQ9KfiJ81PXaS1YfSRCy58r+WNsrdzGUlrj9cGnbQDTCSkYhtiOLyKObA/hAtyB6wgDrq8UnGT9ZEehU982CBC4FkbVttq1yM8pc35oAlrasqpcqtUsmX3uJAbSXJHAinwdwE+yIJpmyhUxJ32Skqh5s9R/gAsRXLo/tRvJFGJ5BPCEPq3Zp8OuJoucKTlgRhYMsceaM8YH48fwsuIq8etAUad48Fe6/0WYWi6CKyqPRsReETUDxzgJ0Fw3fXQXzZ/6aK6enZeiwCTOp8uQViqD+rDmX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z9ZbPs+GhuP8nL4CCs9A+E8abZ6IsLr0FUV6REMta5qn8lIjrutjmkZcbSIhjCOPwl0fS57jqd3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 970c775f-e57f-483f-9dee-08dacb8caf68 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 06:50:32.7574 (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: XD0OIoErWlpXsJXDz446CZAl1BzebT627By1Uiw2fIlhsfTyQTRH8L7FrybwgujEEqxDrLDPQQtagH48s9juGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7142 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221120_225034_880508_4EF13237 X-CRM114-Status: GOOD ( 14.28 ) 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 --- .../devicetree/bindings/mfd/nxp,bbnsm.yaml | 103 ++++++++++++++++++ 1 file changed, 103 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..b3f22b0daea6 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml @@ -0,0 +1,103 @@ +# 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 bindings + +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 + + properties: + compatible: + const: nxp,bbnsm-rtc + + regmap: + maxItems: 1 + + interrupts: + maxItems: 1 + + required: + - compatible + - regmap + - interrupts + + additionalProperties: false + + pwrkey: + type: object + $ref: /schemas/input/input.yaml# + + properties: + compatible: + const: nxp,bbnsm-pwrkey + + regmap: + maxItems: 1 + + interrupts: + maxItems: 1 + + linux,code: true + + required: + - compatible + - regmap + - interrupts + + additionalProperties: false + +required: + - compatible + - reg + - rtc + - pwrkey + +additionalProperties: false + +examples: + - | + bbnsm: bbnsm@44440000 { + compatible = "nxp,bbnsm", "syscon", "simple-mfd"; + reg = <0x44440000 0x10000>; + + bbnsm_rtc: rtc { + compatible = "nxp,bbnsm-rtc"; + regmap = <&bbnsm>; + interrupts = ; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,bbnsm-pwrkey"; + regmap = <&bbnsm>; + interrupts = ; + linux,code = ; + }; + }; From patchwork Mon Nov 21 06:51:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13050363 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 6AE0DC4332F for ; Mon, 21 Nov 2022 06:53:09 +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=L9NPldP84BSuKHFNNnp80yLQ2hI9sb6RZF5kaX+LDjw=; b=AM+drL1rudQbO9 GYk9fwOfP0oOGl9RcxJ5oVWghXDC7s1u4VJ/4yy1dVS3aCO7LNqNJMQdnIhVT+8a14fNaVdFr4j3g E07IMeByKjkuSON3Yxh8v2zaxcCDUhwjTwghtfg8OLw/lgRWdRa2WYqZU68r6rggIbXwqd+FHDtk5 Psi41JnZngdJ+D7A3EYSVHyKd3oZMxFd4QiUucm2lWkowi3KhKZAzcZn1W0tQnpTBUwsK36QxOG5M osuzAE+1uhagSk2xUPAQL95GtRCyTpXh5EaHqvbNwylBC6116pcauIvXKb9Fiu77bQeNh9oo53qOQ cDNPiu/4jH8zr1wlwq5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ox0ef-00A0br-9y; Mon, 21 Nov 2022 06:51:45 +0000 Received: from mail-db8eur05on2062d.outbound.protection.outlook.com ([2a01:111:f400:7e1a::62d] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ox0df-00A09U-Lp for linux-arm-kernel@lists.infradead.org; Mon, 21 Nov 2022 06:50:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BKER61tB9x2oNIcBilZydUrATQ/0t/0dyIfL3pOUZl4pjsfBo4SDTnvimVk83qQxILGMMdqvM/38/PGDNL0uFa1Kxfa4wFPtN4qDs+dEwNrCLPgBTKpSQKyfA80OYJlqRHnJgwVB9pWD9SKr6rIxR+aoAG9+4VknLhLTvDG0KDLysj+WsD/dZYl0k7Hkut8ti3PfSIKwJr+01J5s3yy74QzIZghSS22X9oEi3bNjRL9PptQ8my+iIUEy2puRZQ76oGvxUPjqXwe5gho2COLpkn6I6KSzSlLyuHRr5ajW9I1n79o9KZ9FXe5yQxv0Yks+FyDLuuaP1RYVItVynN8vhQ== 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=twZ4kE3HGBLFdjhdYFbPxxjYKT9szIVLW74aZ8MTRnw=; b=QUsu4dtaN0PQRvs4YnSEyAf4NMcKMRHUQTJzmEeKttoX78ADOGtTbYoEL7v+vGuVCbMpP4l2+f1msAlhfBK2IE5gtLH1Tby223McjRwXcs5mgrOffWAb2KVjQ8fLq+4MCgDnwGGtmRPjiHyQEA6k72C9UpOGQ0GSiKSEqNjcPzcjMfaScbqoSzBc6i58LRk6RSd5P1ZTFQC8+rB0JcCZ4l3BZ4aUgcVTLMUyie6galRJeXPnh/xwJMp9QO31spLGV2hoavyUpVc4ED5Fi7IsPXadlQmZXakqmItkxKM7aA9vq13OB58Mzr83rGo0RB6SBkfN4bWrPl3RVJOVeoopnQ== 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=twZ4kE3HGBLFdjhdYFbPxxjYKT9szIVLW74aZ8MTRnw=; b=q2qM3HvUzHUnzjDY/ddA7QS3kbd4cF5BczILcWcyFGgI7L6F40Q3RmO8RLei5cOXMy++XZr/0VPkBvp7RYe8kD91u7O8kItn5IuzhImY0E3BrAMBgXb/9RzmSUxX9ee5dnQHUc4HpoDEv2nr4/3QVpFKFm0UCAOjHuuUT2ZcOPI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) by AM7PR04MB7142.eurprd04.prod.outlook.com (2603:10a6:20b:113::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.9; Mon, 21 Nov 2022 06:50:40 +0000 Received: from AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::9ded:65b7:9d51:d37a]) by AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::9ded:65b7:9d51:d37a%8]) with mapi id 15.20.5834.011; Mon, 21 Nov 2022 06:50:38 +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 2/4] input: bbnsm_pwrkey: Add bbnsm power key support Date: Mon, 21 Nov 2022 14:51:42 +0800 Message-Id: <20221121065144.3667658-3-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221121065144.3667658-1-ping.bai@nxp.com> References: <20221121065144.3667658-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR02CA0123.apcprd02.prod.outlook.com (2603:1096:4:188::22) To AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8642:EE_|AM7PR04MB7142:EE_ X-MS-Office365-Filtering-Correlation-Id: d6fe2a80-1467-4cc3-46e6-08dacb8cb298 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aaCO0AJEU0QTcu6sSXHTQE0VAPzjL7M2BZzlsU4aKG8lJw4OJebnCzJFz0KToRanK2eqdP6kl/bil3fY5nRKOLxt3+/a9PM5dMh6DD2vcXX0/8jhrRFOfTOZss2KKRjNdGPSm+GzrjWmPaeqvDJShRSgEbA4fNSGf3ZQIVGZgz18Ip/MAvbslFRB9MOtjYXZ2NEuuEuVrCGvQQKb/DOXVp+OtbqYDdfpRrcewwqa63DvzVW2OmTPAzDlkBRk2p0Iw5SyhQVM+uWDcNY6+AEQPtJkVqCqtfBp3/5a903IXOxM87jBGNf2e9DYxGncoVoF9rZICszPoJBSxuYv+gbWQlO34iM7MWCgNDATP8oPywYAyLTqFyuglNhHJXqgmPTptov53iK88OwDAalEPNLqYiE4kPDSJVGM8pI11oyaN/uJgWTcy8i6QPg8uRIHpV6dVoj9f/1YLBM8mAFcNvpXxWF1XG197qTg8BzM0tO2LeNCFdv0+JxlxDtPqM3tPR6UGHiQWE/5DQ9zXqjbZCYdpd/xpUJSw5uGrVGIw95JWZF1bmnS3VI0Eaaq3+VjkBAm8oYtX1v5XylFBYSTW0rGEdNh7B4W2mTDOB16mPK/IPA1iQZr1WUxV8tGZRDOVajr+6lzayCsA9XA4XU+Den40+5TrAyWCtMpWFTxz+bbkr3c1O/8Wl1a38xqbHpptchbW3O7aKn45wyo7ossY35NNg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199015)(36756003)(38100700002)(38350700002)(41300700001)(2906002)(83380400001)(86362001)(66476007)(8676002)(4326008)(66556008)(316002)(6486002)(66946007)(6512007)(26005)(186003)(1076003)(8936002)(5660300002)(7416002)(478600001)(6506007)(2616005)(52116002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1aJvUEkAzZ92RXm0tqFgKVE+TBp0E19TEU+m8gP2YhPlEfrJDQfMKJWj5AIysglqwRWPkp9PhTMrt2jgxc6QuJKK2v7cXXHR0hxT70gacrXlWxW8j8bRJJJAusyMos4qZPYqd5nRhZs+oyzcVs//ikg+DGzgYpOemCJudGW6wnPMmReHwYBhxf4KZN5zZiyloJIkv1eO4Gm+9jQZX3s+eWaIrCOb+/mWyuu+2kriH5k3w9YR31mYsPtffecva4WlTazHVx8paEbr8Pj3Us5R1FoJMjjlo/rgbCKFXBnz+9EQLl9u3fvMY8CR252RgVVcj7BPTegE7ciEpvTXrjyDbkqgInoyw8Xb7G7Ja17u8U5FTjxIGFmp/0FmRJwA5AWi7podydZkJaQqZknbvFwee67RcW95kEB1sY1UGNwiFRo4iFqpLTdxPz8haHDUeEQaMI8TzAPXeNSSOY7UlqLJPNnKE77DouIDVW7h2F8Q2jfmK2uXO5UJe5ERuZA/kZck7z7UYmdEmDr3FVdmuxdBqwyC/yfc+e+7aZ1NdtCBbif0pZ1yQGPQj3rL0XCkREWGHSVnU5w3RT5gkE0Zj+Mw7ih77a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MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 06:50:38.0405 (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: eTkgSxt/K96JIIIAbUCGAq8yKqnvmWo/3SA3zdlqLHTSXt+ioLoj33SvnDYUIQKFXBYw9D16oHcMME7u2YVPYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7142 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221120_225043_908799_EBAEFDF9 X-CRM114-Status: GOOD ( 28.00 ) 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 --- drivers/input/keyboard/Kconfig | 11 ++ drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/bbnsm_pwrkey.c | 196 ++++++++++++++++++++++++++ 3 files changed, 208 insertions(+) create mode 100644 drivers/input/keyboard/bbnsm_pwrkey.c diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 00292118b79b..8efcd95492b3 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..0bc101e004ae 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile @@ -62,6 +62,7 @@ obj-$(CONFIG_KEYBOARD_QT2160) += qt2160.o obj-$(CONFIG_KEYBOARD_SAMSUNG) += samsung-keypad.o obj-$(CONFIG_KEYBOARD_SH_KEYSC) += sh_keysc.o obj-$(CONFIG_KEYBOARD_SNVS_PWRKEY) += snvs_pwrkey.o +obj-$(CONFIG_KEYBOARD_BBNSM_PWRKEY) += bbnsm_pwrkey.o obj-$(CONFIG_KEYBOARD_SPEAR) += spear-keyboard.o obj-$(CONFIG_KEYBOARD_STMPE) += stmpe-keypad.o obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o diff --git a/drivers/input/keyboard/bbnsm_pwrkey.c b/drivers/input/keyboard/bbnsm_pwrkey.c new file mode 100644 index 000000000000..288ee6844000 --- /dev/null +++ b/drivers/input/keyboard/bbnsm_pwrkey.c @@ -0,0 +1,196 @@ +// 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_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap"); + 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"); + error = -ENOMEM; + goto error_probe; + } + + 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"); + goto error_probe; + } + + 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"); + goto error_probe; + } + + error = input_register_device(input); + if (error < 0) { + dev_err(&pdev->dev, "failed to register input device\n"); + goto error_probe; + } + + device_init_wakeup(&pdev->dev, true); + error = dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq); + if (error) + dev_err(&pdev->dev, "irq wake enable failed.\n"); + + return 0; + +error_probe: + return error; +} + +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 Mon Nov 21 06:51:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13050364 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 32BDCC4332F for ; Mon, 21 Nov 2022 06:53:59 +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=N8Jm1GEBGd07No6+kKu1OlE2B5Qumix/kOHVe3HWJPw=; b=eQJ4CYDtiFYMgi eKL1MGxwPn0xEcBmBMB8hhb6zEhzFH7aeBLqwe5G8k4RXTZgLgiFfmh/a9UlbFdU9YY4p5yRbTDCQ VQ1SdNCYN7eUyWF9FQoxfia0wmJZjT9UbPtT2PwqINdR0oRInlZWKZemQTKumh6yW3kRIu5+xOO2j kyXy16l3kIrPIKRkL9IHdSIy//qpBTE/RycbuJ2mGwfmlbrc7JZmBW4p/xnIhRkzgedRnAzMwSTP0 N2/ivKknqn7z9DZdp5KaT+ephv58YiAjKhuJsYNAQNIIHnfpMLUG4ORxAtjp2ZgnB+Pa9pNNH+OUU PIrDEKh1UzLJW/6w7VvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ox0fK-00A11a-7Y; Mon, 21 Nov 2022 06:52:27 +0000 Received: from mail-db8eur05on2062d.outbound.protection.outlook.com ([2a01:111:f400:7e1a::62d] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ox0di-00A09U-3I for linux-arm-kernel@lists.infradead.org; Mon, 21 Nov 2022 06:50:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZdVhaH65y561fPqGip/qY6eRzZ7KUu555JAarwU1rBTevdkTk38rB0qzeIAV7EDPDFtEiUXqhQ0k5R39v1RHLdocWvKddvW/eVh1hJlJgkQ6Krv+MGmKAxs8MKQexRwOLqsh2CZoqOUPVxcW+LSZp8YQ34m3gDKGNaT6mXXrz4Nu1oqTtXCiUgvxNjH4/CTtn+C/K8XlMRtwK9K6bCwdR/EuczGbWKH834eg2m0jMUxrsize2HwPekMNWW1NoJIep0ohhYX78OBmKH4iFKn6qUfxQSh05aofPffkES7hCjFYLGxXNtroUjHl3r0bgPcQPm+rfLNXzm3pALTfxWgdKw== 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=keftd6s5Q3q3PrBgQ/afVH7e4t3ZzNQJPCEv+VeKoms=; b=ZzR6e3RdrexJh+PjTsyFZOkcLCreYafty2jJ7Nwu/Aifrcf7FOZVoOFEIEbTVmPz84yxBfqcbY0T1HeajTd8gMd4WRB+By1n0CORYnMBRnnKno2FYNDGAjrSvVLggEtY9BYNm9fKSOVTP98bAT5may/oESg6wFihpNjNzKA+NDcU7AhixEI9NkY1wruOk5v4qq1knMZmVPMMNCVWuK8cxWCHQlKvxUBa53eRDMZzxIpV5Fdbtkl0IqR7I+g8U7BZR39OJjzCd3IBNiTbEXZjaP4aGHJMM4GJUoy0r4xQksqN4P1e01fDCPjhqeabBxs3MX5xrO2xafSZe4aNHtgqQw== 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=keftd6s5Q3q3PrBgQ/afVH7e4t3ZzNQJPCEv+VeKoms=; b=AgKHoIjnpMbn9im0p+0SgUw8akZW9KmzehSVRIInJ6hWzsLRyW6TEUNgaV3sAWJlwHMkt+5awS8Qjmarc4A9hp6ajCXZWFxhN81YlWKd1rcF781UAw7XA47Oh2MsdHT03mFJK9AWZmsWfGj0mDIk/WftgRrN5HxjBt6LtTr65Hc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) by AM7PR04MB7142.eurprd04.prod.outlook.com (2603:10a6:20b:113::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.9; Mon, 21 Nov 2022 06:50:43 +0000 Received: from AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::9ded:65b7:9d51:d37a]) by AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::9ded:65b7:9d51:d37a%8]) with mapi id 15.20.5834.011; Mon, 21 Nov 2022 06:50: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 3/4] rtc: bbnsm: Add the bbnsm rtc support Date: Mon, 21 Nov 2022 14:51:43 +0800 Message-Id: <20221121065144.3667658-4-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221121065144.3667658-1-ping.bai@nxp.com> References: <20221121065144.3667658-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR02CA0123.apcprd02.prod.outlook.com (2603:1096:4:188::22) To AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8642:EE_|AM7PR04MB7142:EE_ X-MS-Office365-Filtering-Correlation-Id: 35aa7a1f-0bcd-4972-6f71-08dacb8cb59f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qwVEpscRlKPRSvOYIbbcX0So9e37Y+uDqodhiBry4os53XYNNmJWNscjXsUyv3Xzu5Yi6eP+tzThgJy34MtW8J0zyoQHxfOvHQQHF11UwoX+eXZI5fHzzNNDD+c0RDUAJP2BVCpjk/N1+9YfOostOX3pF11+tZiVk2kI81Sl+lI5cjfp3LAqUAH5HdMuHANTUVUpaZj5BuSPOkOB1av9Y4KcHcr/XZ1JSUOie8gzkwl6D7xfFXMXl9n7jAyGgTP2TS+FtpkBrUP4NZmdlZGMSzpPIvbs3exNC1qLd/+7isyJsy0Ep4HX/YJ9TFrrcjg/IBiCRxo7qLU+9RxLChcNjt/fq8+DraX5Iues4dBQCqJ+EOQuU54UbedVddD47zk0sHIXC9deo5dMPdZ8aI+XwF2r1HcNk5nhjlnTmYe1cpM2sNJiJBJ5Y9LjMbFYtxI1Am/+/KqK6DL/ObIKq/saoeuI7zpbaQCHQdE40USfxNsYXho5H/scCcPQq2cKmdf59G82aKsw0WUtjAgcmXPOTsob43UXiTgSjJWB/MsgfJxxDAiIp4B/4eHYISNVTiUG7opn+hIH/V/ykWdzZmhWwd9fBwMcD539Ox71pZeyBS2O4SoBeH970lwLEKHqKLFakCPdvaQ1RqipDMogzVyWfHaIp7HUvnnt0wH1ikfYtivEsPx7lzVsp6hb+mdE9UCWdZA2nEP4uWBXe8fUGh2GUw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199015)(36756003)(38100700002)(38350700002)(41300700001)(2906002)(83380400001)(86362001)(66476007)(8676002)(4326008)(66556008)(316002)(6486002)(66946007)(6512007)(26005)(186003)(1076003)(8936002)(5660300002)(7416002)(478600001)(6506007)(2616005)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tNuVaW2q7EaMR1zHRIRC0NcvH1cpi8pUSV75+FF6XuvI6sNWyQyHul5VZ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ZQcPh0MoDGD50pEJensB31nuWz++7j8ovUGwV30jHTiZ0c09fKfhcyi69Ukd1Kd/E2p8AczZnTYQz2e2bnCmXE+3HECQKAiFWOxj9T83hI3TeVHCbbj1gkJhIcQCNnzaACcHbBZVulBvJIEtAgiLk2uJQ8iuGLtyxRSme+b7HBdLGqiSR6eaSRIrptiWG3Wbg7re+jEgcvpYuyS9RbaOLgoPJv1cmCX0fYTDCEsxfycyqIvVCqojpMcxLMUchHOswzGgHxjMTizrKH5RAObFId5sfQm/k6PS/FKUwoNxTmzRsKDJVvQXf5UV9h785KMB+x8RVP3WaWJeEgCGpOgXzB8VwPiT6XFgWJvCa87rKX4AbwfdJTRbQPxJikD+ggZMw5nCnX5NJr5S89kxQTfH9ue7wWfUVQgknNOJRFfWdu7goW4fLYYh3KJcZNGlLjqPkArOE8J2DOd X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35aa7a1f-0bcd-4972-6f71-08dacb8cb59f X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 06:50:43.1361 (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: gjJx4HMe9pEhnCpPjEsWbvglIOP2erg1zukY9h2rnxFe3OCCryzDMZ5Uexc2iCJdJf1t7A5mvkK/9321+qJc9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7142 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221120_225046_225295_BE9F1984 X-CRM114-Status: GOOD ( 27.35 ) 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 --- drivers/rtc/Kconfig | 12 +++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-bbnsm.c | 223 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 236 insertions(+) create mode 100644 drivers/rtc/rtc-bbnsm.c diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index ab9a1f814119..0c8534a49c78 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..43bd29b2f42f 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-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-bbnsm.c b/drivers/rtc/rtc-bbnsm.c new file mode 100644 index 000000000000..4157b238ed9a --- /dev/null +++ b/drivers/rtc/rtc-bbnsm.c @@ -0,0 +1,223 @@ +// 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 TA_EN + +#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; + + 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; + u32 event = 0; + + regmap_read(bbnsm->regmap, BBNSM_EVENTS, &val); + if (val & BBNSM_EVENT_TA) { + event |= (RTC_AF | RTC_IRQF); + 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, event); + } + + return event ? IRQ_HANDLED : IRQ_NONE; +} + +static int bbnsm_rtc_probe(struct platform_device *pdev) +{ + 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); + + bbnsm->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap"); + if (IS_ERR(bbnsm->regmap)) { + dev_err(&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); + + /* Enable the Real-Time counter */ + regmap_update_bits(bbnsm->regmap, BBNSM_CTRL, RTC_EN_MSK, RTC_EN); + + device_init_wakeup(&pdev->dev, true); + ret = dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq); + if (ret) + dev_err(&pdev->dev, "Failed to enable the irq wakeup\n"); + + 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 Mon Nov 21 06:51:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13050365 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 539FCC4332F for ; Mon, 21 Nov 2022 06:54:28 +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=tcWEwF3HAt8woZW7dSPdzil2GHWQ2jybdmi7eBgMCe8=; b=3PRxhK09SAPtjm 3XBk0Hbx9RjfJP+DR+BlKTdBXYukVtCwJCAfvfJMW/9QvFWNshHpouyZfCqDfcriIPcNaDg1hnFNu x9BJOdKUdsEL3dPNRoV6vv+6Bh5TXukFDbKzmCy8yCeUwiDM5fBwb+LXSTGKDy7IbAuD5qg3ITTEz Slvg5WqQkT35MIFfWIz8rlAI9U37SNPpXEZzlKtTm/bt/FrxwgNY9ChG/qWo8YlfRErxtqQRGsl/K JwtoNdduVA7ybjNPPhbIiGuu7E6gHe1OknEaWBys8LhxRsTaXgQj4l/0qwX32OgZJX9GwO3a1SHFu OWnhaiuRvql6Y2733PEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ox0fr-00A1Ks-Lb; Mon, 21 Nov 2022 06:53:00 +0000 Received: from mail-db8eur05on2060d.outbound.protection.outlook.com ([2a01:111:f400:7e1a::60d] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ox0dn-00A0DW-Vk for linux-arm-kernel@lists.infradead.org; Mon, 21 Nov 2022 06:50:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mf/edg9DH/oRZE5oruxhMZSyU+GeAOLrwZTm+xqCi9sQiG2HXNVR8qYdrTZDe3bo/LGTiMXIVCrQGhGDnDhY9G8/8Uno90EHgTpB7pt6Q8vLqBsfa2ecs9QNQAr7zYWvuz3iVfB4EpY14c4eN+jvvCO+HNqi0v6DuC0te/jv63bnCBBqTyq4OyrM7cx8RKO1UrpoN2rG06RvwLwAFDkYTaCveLmPRcd2e4aXvabAbvPnzwuVv8k3qJyUmcCb5mxZcfL1q/8RdiyMvf0IIwZy/kRwRB/po3qaYD6sCVh+0/tu1Si0NWXxBbbBF4dxxpO7+xpjxVAZhxX31UOFPmvgbA== 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=LfgLtaMOasLXkbfsXwk1zYDShrsDH1iqAuvASkFjpU8=; b=Tqyl3/mzcs0ZRxzcO1AcYKUn7e0e9xD0n3BH2exjJZFhyh8n1oF4Nd+vAwm7WykYdQizw8abcCr3aaARXdDuAKP/5VpZO6wQ+T7GINy9+N76o0Pi6m3N/55J2vERwl4lREREINv8AvxtEzC1f7hkC+JwsOg5yXzoVcaaDnH2MQ2gye/ErNNzXfsOOufz3C1bfdbFSCP9kSylzO2E2Z/w5DUMCteDULFIqTPAp4Xbej8fSGTAxw5WcGoM3+yykNme6uQgI7eY3H3FsSHybkkTiWB8tRr1B3YLAtn8dOFdwQR1Yx7WS/8FVGPOVs+oUeayeOHHYqCx7BCJ1Gf3mW6ocQ== 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=LfgLtaMOasLXkbfsXwk1zYDShrsDH1iqAuvASkFjpU8=; b=SQdacSIsI9884UyGzDHEjXhAx+/BmPLzz6Stf3XK1akTC6+s7iR0WPwO8c4X1feqzy4QFxtFNYOk+uaXbOJiQxtxl/tQ1EAdDcWcnFQOvd3eBUMRmz67tgrR1TNc5d8u8/hpsisixZhyha4ofD1VWy4vSzkEi5wud0ElANo8Msw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) by AM7PR04MB7142.eurprd04.prod.outlook.com (2603:10a6:20b:113::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.9; Mon, 21 Nov 2022 06:50:48 +0000 Received: from AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::9ded:65b7:9d51:d37a]) by AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::9ded:65b7:9d51:d37a%8]) with mapi id 15.20.5834.011; Mon, 21 Nov 2022 06:50:48 +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 4/4] arm64: dts: imx93: Add the bbnsm dts node Date: Mon, 21 Nov 2022 14:51:44 +0800 Message-Id: <20221121065144.3667658-5-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221121065144.3667658-1-ping.bai@nxp.com> References: <20221121065144.3667658-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR02CA0123.apcprd02.prod.outlook.com (2603:1096:4:188::22) To AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8642:EE_|AM7PR04MB7142:EE_ X-MS-Office365-Filtering-Correlation-Id: 80a0eda4-d7d0-4db7-307f-08dacb8cb8a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PidJFgIO/OYYt2ttrDiITZ9J87VVZA5Rt5pVHofV+Cz8l9P2PzGRGidcHTIQhGABtlrC2k0zvf40No4cA+gB5AzAio7B7vb59FZRKO630tPhsxou4rZ+g8XpdIq0fbuqFuSwxBnQFF3swub1PR7DbqWRxvi+hC1FJtSQ8+26moqMBu+skFQGAo0qMrqUh7rIJng7zmXZmrnrw2qvF9LgI8SBzWBWJA+qwMOkCo4gS2QQZwIzb4hotl+8NXQHkmM3vBxu8XlpcAgNS4RSt0wQQJzmfdWzWJfKgthmYt3w7tjwljlEuFzpoDXHDVAhLgXtFnUrvQ+1uT/n/4bWiF3scb0CM4uOqXZg0u3vzRztzngZ9/XnmqJxlJBz2ODg2N0AkJgf4XhB/Prz0O19JYdZ41aG9PpM7RQ5ZsnV6KytCs88oTISmKVcWsI74GY9zglBF4ZH4aMrQqdyWDmkkUViYRHj2kofR93umvRGBH/Vi9X7zKC578QaaCwpgl5FefE5CphwYOw6nv/bkAzyFHGSp4jpMpBLAWounFl6MgCkxzyefMLoHsSFyNWXJzK6NoQW9dPBVWcB+1r969CyJ2QYlk/2tyAN7kM9X444GhLt0RmCoqLQsecAy/b8Wc/W6TWA3D9IrffmSjFqQR0odwhRTWy+utpldbNyWPxNOpY2e5C+NwcuUtTTArnx+KaGsYT31goJcXFWtFkk2kUzZiaiZg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(136003)(376002)(39860400002)(346002)(396003)(451199015)(36756003)(38100700002)(38350700002)(41300700001)(2906002)(83380400001)(86362001)(66476007)(8676002)(4326008)(66556008)(316002)(6486002)(66946007)(6512007)(26005)(186003)(1076003)(8936002)(5660300002)(7416002)(478600001)(6506007)(2616005)(52116002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +kj09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fXcLX41NoadJHiJXJQOdZ5mR7TcCzdfBAl7S8dExCLninuZrA5veecbeAD93ynOX8Rog0x890VVV8Gq6kXK2GJGOQnnRVbYEH1J6SgAzYDZ/Fui9077ulQqt4AJMDKsUNki+cRSV6ZUNXpi0N5Mfa76Ml5BNddRjC3mBbnEKpvdF5H61SUNP2mdyRabg3cPaFHzcaw3mqWF9fPtv+HTjy1gTyol1NJzNlj066GrHi5mVtDaH53iuUUmmtGLcwAi/C2nh/S0I72nBaPH1pURPk+EXZt5Eygfcidtd+E0aBcEhc4/CrjFp2ZkPh/faEGd3OsSjc6xGJh0kqVR1Vd/T9GYUgIejEKs5OrdMuD16LXgqjGo5AF0Z/MN449wcyQDJDzhHS7gOJHmapz6p4d3zZaR+aTpgH57tLKPaYDtFm3vHsKvbJoVnzEvU9z44xeNWc8Wlu7V3DoyyoDncYbTSr2ZcO8+RkrUJTKZN2tSNYGNRABM+Opkweav7kmYpVr64c0VdRvNBzj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80a0eda4-d7d0-4db7-307f-08dacb8cb8a4 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 06:50:48.3098 (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: RR7xlF/Y+hA9BtMIjvyGY54QbNjc1gh1fNfvQrZc3aASf4vDAQ1R4nyRoXdk0Ci2wBV0CJQLdF0n8EY/UOgYbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7142 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221120_225052_066852_21E018B4 X-CRM114-Status: UNSURE ( 9.54 ) 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 Add the bbnsm node for RTC & ON/OFF button support Signed-off-by: Jacky Bai --- arch/arm64/boot/dts/freescale/imx93.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi index 5d79663b3b84..ffc4f46c4820 100644 --- a/arch/arm64/boot/dts/freescale/imx93.dtsi +++ b/arch/arm64/boot/dts/freescale/imx93.dtsi @@ -229,6 +229,24 @@ iomuxc: pinctrl@443c0000 { status = "okay"; }; + bbnsm: bbnsm@44440000 { + compatible = "nxp,bbnsm", "syscon", "simple-mfd"; + reg = <0x44440000 0x10000>; + + bbnsm_rtc: rtc { + compatible = "nxp,bbnsm-rtc"; + regmap = <&bbnsm>; + interrupts = ; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,bbnsm-pwrkey"; + regmap = <&bbnsm>; + interrupts = ; + linux,code = ; + }; + }; + clk: clock-controller@44450000 { compatible = "fsl,imx93-ccm"; reg = <0x44450000 0x10000>;