From patchwork Mon Dec 26 02:39:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13081573 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 9ADBBC3DA7A for ; Mon, 26 Dec 2022 02:58:29 +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=cqQLlvvWXWaW+URBVL4HcppjNE7+t0SYtYJ6BjKKcyM=; b=GerFpeXhQP61Y0 fnU1O3JzWqfTo7XbEExjipEavFQe4pjHJkSOaiIY/zAFo4s/TlEgmJvUSFWEMpn3jQOqYgaabC2hK NZdiTtYldSorFRA2IYl6nRCUuo5Nz4FpdPgqIGpZd+id+oCAUSmjIxPkXgJe73AjTWFfyqZZXyuru zh0Do2kYJd0kO8MXPnhtIgki326BSMmLDq7BKNW+4dUYumdUhwfJtSeC6U1ABa8wlacqhKdQZpOom RhtON277ByHWcTguCIoq21iogPKapEq75OwZZ83uwq4HuxSwpnVLS2SFTYOxxKMrVJ3YoBo912CBR VfdXmG+2mJqGvWEizezQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p9dfu-00174g-FL; Mon, 26 Dec 2022 02:57:14 +0000 Received: from mail-dbaeur03on2048.outbound.protection.outlook.com ([40.107.104.48] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p9dO0-000tTp-1b for linux-arm-kernel@lists.infradead.org; Mon, 26 Dec 2022 02:38:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RnbiKTx0KWXYs40mk2KSpAV3lVHEPyrcv1d8R8MpX56jLJBob4uGdUGLgfo1zKYn9/AWHU3aO3KNUUkRe4jxLbYrZqdPUjyrNl55I61AFyI537vy9OShfWn65z/kvb8YJGmx1laHyYor2FwG4hI0D8y/Nl2ktC728MVmPaOjot55OQ/rA+lwaaaTVQvCualOQI7iheGNH3hmMcrBMh+qiomfhquYRw1l/qAxKRAx/Eqt4MR+L5U6F1YQN9zaqSFLbwG7sLOZOPhk4be1iQ4YvDj/Fnlav16uWT7N6uPbbAUKceRPk+8dG4R/p0rEHEGhqVIGHDgSp/wxx3bOqj/SNg== 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=1MpW+Z0cRvf8pK5GbfwTu2PmsvsvPIdxYms9vwP67p0=; b=U3T775zVRxiSjPjsSfJ4MqTmdyQaMEFQ14dPzaEqF0oO/Dvb9WCGEZh0Zxx7Dk3F305AXeMEKcgKzrclqMK+ZnJMFGrZ9XwtpBBg/oz9ZaynIfSI5x5UFJv6VbYL4QaZiDbjGhU9BNuspNmMUPFI8SBbzBgQAWptOt3nlYe0AYXBmGOS7XIu0riKqKFTRvy98JS31wvqwzqXqYyn2TxE6+SW/rOvptGxdD0Xx+hV6rXdIfAj96afOBb8Sv4XZmjZY6bzxEYNQqEypRlPpq5kFWUHvnrxC6RBpD2QMGQTubm/xF0VBh0pugqvw9OTRTwDMYr+P5gia+xHnQfcxNl6PA== 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=1MpW+Z0cRvf8pK5GbfwTu2PmsvsvPIdxYms9vwP67p0=; b=Xfk1XnDXgHftm/1ceDiH3iW1sDo4DyRT79498W/wVqB0isCCvWeQf/KwmUPkdop3DcFYu1LsQw/1tV/Ik4KD+0If2mtYaS4r3Yjq23KnGyG0yyLe9JGRyQpX2PMm3jcQ9DywOjSvJBxXXQZ88SY2sahS1Jbs5GwH0PPGtAlL+yw= 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 VE1PR04MB7328.eurprd04.prod.outlook.com (2603:10a6:800:1a5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Mon, 26 Dec 2022 02:38:39 +0000 Received: from AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::ebf:5645:b490:166c]) by AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::ebf:5645:b490:166c%7]) with mapi id 15.20.5944.016; Mon, 26 Dec 2022 02:38:39 +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 v2 1/4] dt-bindings: mfd: Add nxp bbnsm Date: Mon, 26 Dec 2022 10:39:39 +0800 Message-Id: <20221226023942.1027270-2-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221226023942.1027270-1-ping.bai@nxp.com> References: <20221226023942.1027270-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR01CA0147.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::27) To AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8642:EE_|VE1PR04MB7328:EE_ X-MS-Office365-Filtering-Correlation-Id: e98574e6-3cb7-452d-25ea-08dae6ea4b93 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fijtdm6z7Gb2myYz393ZWj2M+yk5A3SE/gYea4Y09XzAiVqSCDhXe2HI53ZFqOHvRgUGExaxhTVXhP5kMyX552IUYFRfTyblMy7kYXc0S2mcW/7Fv9zMfVEejEmCglh4EiPiJTwBAUJyDxsGCWCNrDQCHpdEVttr075I0zrTDbXeFmpyaNP8wFSh26SuKKAG5lr+53lG40V51RA5KWf2swYbNuEUWM+Vq+BxbAqnQlx/84c90PFQSuHjk8kdg4dDZ5Cz0Tm34011IPHAYMeYlFkTrB92URlRtW4Z1FfCkWWjUsSTCLQCc8/MqfAqyzM3NvixU6Qb4r2WRaf3LnCdzeG8bnpUvLSE1JczR60ew7ePyDKvdd3VQ5tPt+RzytDB9Xho2qxJgN0gQit/PAKgAiW76qiBJiW+ldfibDBsz9Iz3wjw0YAYjRpv3ia5WOfYGILhuTxbXegJgBsuywEY6NpnCisKkLPF5G8YesoOXI7p+/keiQRsBFGv5HlyPoJUiUbi3ZNxULribyBORUbhxFvRY+r3LCFVyJxIuTKHIpdJclaVFOIDl4vtlVYt1I1aLO0kGVNvy54fgNiIWQvhRNm7VHa8E0ukFGHQfkNP2pDNoNjYRsq4WnKtyT96+8fcItejcOu5AR8994bhuRSLGY7rdtHQGZvkwN2zWEIeQD8zgj27Z53hagmjKTGzXV1pKTGkKUuH2JrveCwhsySDa5/eZhMZ+QqfxRy7Ucy7+YIcsg17eZjI7LuHV+arnq2j0pQzYGe//3RMb6b4i2qBlQ== 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)(396003)(39850400004)(346002)(376002)(451199015)(478600001)(6486002)(966005)(2906002)(316002)(52116002)(36756003)(38100700002)(38350700002)(1076003)(2616005)(26005)(6506007)(186003)(6512007)(86362001)(5660300002)(7416002)(41300700001)(8676002)(4326008)(66476007)(66556008)(8936002)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WboX4/BPhWQvsTw8Z7Nd5Qi5jo6zuHnYXpHW3KGba1JyCIzgl5EPuqVyOmZw+fbAXMijthmB6fqfwCHsrVY2t6FDV9m7TAI8lclcWIn22VsY59kELMRw986EHVc7xisnTnAsAaTUTompGFyqE6RpDJWjY6329V5TxoPEsVIKoXSS2k7GEpMUfl5XlXtkVDxX/v9BhFAmC58ljhDhf8EUfxBiaIExLaIzRoP6wHdM/YMa4D0JxKtXE6MkKXI7Q+Mlr03QbswLVWsSPuFbE+hGgcejJ2T3DTK4L7dS4vi7jIhSRCxAWQx3Y2b/PQzk5DFPFnmkWyRMBiTwfLZAYD2V39Vq7Xt7hTNHR/N9Yui1uijeUJWPloX/GutLXDittpTSPSFN4D/UMMFCr8cxaUN1wxzMGKcxRtTcn1ymQHTRvz6REwNlil6jMTUUR3vbTg7k11cQhVBnHwjcr5V/FdBvXZVptOQJLcANs7lJf3YmTGbgiXl+cXjYzphLV4YNy/WZaxjiG+/jUI/+xRlZET3BSWleekXDFkiauROot2YDMDCP0XiKxwp9wDkJTSe0FtYTg4nEMTzlr//XI+QGMAGxrW8j2MMvSSgX0vUy2iuUC9BT+peUk9uVrDNy38YQxo6E89GeczOgjhkBnr21O30tHzdotybI+6sipu0AXPA0ySdx2rB4UI6uaFuShN+PIhNAHlNTQAhumqOv77g5jpfU07xIJgxTC6I1A4vWkkmUBQo/LwL4DjeglkWKzDgob+pH+N/6Yga5u7Mhm/fCao4von4pmXputNXD/Yy25SLSNhL/o8AgKvm5IaSv6UjIwHC6iXu/ElnPx+xmhZEXPxwkvdBAWHLriESFk5pNn4UydP5UUazAonkzIgUqqLdz8Dw9l3Zu1j6kIWrvYu9hbcL1Njc6vF32bigWZKtsn7Ky5rQGHy3tGPZFlwNhGieqzfalDHxTsEIV3sLk0+rJrAozL/yd6mlHWI27A25BI63HNzAqMAa3qwcHSKXecgVzDQ/8TYQ0LLsoUHQzbqRH3QYeW2EOud8BBs2V/UspUmKauCahID0tHqP5faTLuvo7Gm5GJat+CpQXMg0T2EZwnbhb58fsMheTeJdOM02Q11QEqx1YZmgPrnrEFLDDkUwpI8phRRrUYo4tbY8I/HIXgCNruQXoZAoiUdZDxNsiCfmv1VHp2O4zumg6shelPs2Z7+AjuESQP3OoLq/KV8+0bK77/L/qRnXQuKGV1ll4MVWGdINgVv9Vyssl+masV8U8ulp1xctGJmCAAEjq0ZdTmsmmjSkKxxAxikIBN5sJ4GdK1tv6UqYFiwsdnK1U92c7rRi4BURss6M+hGGZlzhYnaabyIopfLVUm2zGI5JI+W5ZUxUGPFhToz/FAkX4lQLeEPo3UJ18IYY3cMjITNw8QSQpDDFABdqIjrauZBwhPajZBGZXb1ff/NTPWyK21KoImFI4Qm/GeuW6yMd+TCXYBHdGOj5m8ZCtt+UTuQ6pHjZszjOQEG8xkKNh1XBVh+CCQmlsvQLrYalaPRxz84qrx6dF6KpHyq558U3/WuGp0b6NpdJF1Z1JJLOLarA6/RRBD5Bp X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e98574e6-3cb7-452d-25ea-08dae6ea4b93 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2022 02:38:39.2891 (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: c2f6O6dVR/rFQnWf7eoCXUOehb5vy91nztgdLVMip3TO+km2dtLcZ/4S5fC7MZDcneuk1MdYv6K23XSYcivugw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7328 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221225_183844_235491_0D6C87BD X-CRM114-Status: GOOD ( 15.57 ) 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 --- .../devicetree/bindings/mfd/nxp,bbnsm.yaml | 113 ++++++++++++++++++ 1 file changed, 113 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..8d213bce9119 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml @@ -0,0 +1,113 @@ +# 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 + + nxp,bbnsm-regmap: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle of the bbnsm node + + interrupts: + maxItems: 1 + + start-year: true + + required: + - compatible + - nxp,bbnsm-regmap + - interrupts + + additionalProperties: false + + pwrkey: + type: object + $ref: /schemas/input/input.yaml# + + properties: + compatible: + const: nxp,bbnsm-pwrkey + + nxp,bbnsm-regmap: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle of the bbnsm node + + interrupts: + maxItems: 1 + + linux,code: true + + required: + - compatible + - nxp,bbnsm-regmap + - 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"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = ; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,bbnsm-pwrkey"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = ; + linux,code = ; + }; + }; From patchwork Mon Dec 26 02:39:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 13081574 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 E8CE5C4167B for ; Mon, 26 Dec 2022 02:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=lTh/ByVA5DjfSZcf6UnI7Qxl7IZesR/+INI2U+LHFwk=; b=m47z5RYIn+sZvc QmWFSsCuPoQ7h49eZP7i3pd+dpEBQ1aHAYornis4lduRZHtatoHcCdLvM4sRPG9bTCITngpxehcTX O4geJbaXZkQEkLgIxzbeLRgpN+eRwboktPehjdBMkjkZN66iuatA1NnfnPoPNd6WxKRcyc14ejIwM FOYWrudUDqQI+Z1sb92Z2j2+qF8UMVpJuD3gm1G+iUdwEe8iWYQvkVpZ5k2jbQKWhWW1KXbgvHqK9 uaTX5sKadQVJXYQUEXBJY7cUx5Kjgq4E2PYryUaj3p34Im7ZCbPXtIukcwbhFEHHvn3NABWSTtEPT 5S5ID0iCgV6rqa/tU13g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p9dg4-00177a-O4; Mon, 26 Dec 2022 02:57:24 +0000 Received: from mail-dbaeur03on2073.outbound.protection.outlook.com ([40.107.104.73] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p9dO5-000tXA-KK for linux-arm-kernel@lists.infradead.org; Mon, 26 Dec 2022 02:38:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eyauMDfoEhXTY8PJV2E78F7ApingqAesfUBQmAAjOH/R4hOGZCxVPrL3QWLK5XbixAOOkoQFF5qYm5chL/RNfkavAxNnXygEAR2nik7z5l+H0JmvPR5vzmDHvROOO8Nzmn1jky9KbjgjNJI1yGOrke/3dfoeyRqeL7toCZseRR5Ho3ip+9+6ZOnaFpL3nX5ncWoSJgon6SsC7q7v6r1houYhMuKpefFljJ7xPzoY3oVpMp1uUzCDVzGbErFS49ZdRWzGT7cNMVaSo1oCpg/sePMSaXCHVNLyHJypeSbIgQcv1KuHkSob4zsXkNNGqUzoGrtae91u2GIv8UOFdpGaiQ== 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=ZMuD0hrIlmNcv1wJ5/eZiYUAC8zAOTNfwVCXdxF0rRA=; b=ZoG1MNqaDDUIbRc33n80QfjH80j5SRit/dmFOBtzA9CnXtJxuILRNV6poev9MYPSNQuYzEiJUtYwI41J8ZsakjIV8LSrTzIpIF+lVgmTi4dpZ/4xBnKf7NvewQjlqS6hZ3zTcw/ZQpx4xo3kNmAxMxE1aKBLmNmCQnYEpGO41Uvl5/KjZSK67elLWbHYOyDkV6RdTe+GV8U/qKgcuEQ5ltfLAJYO1T8fSBJWIscinSuU5JI8pA6q0JDHzZfOF+FEBVx3db6ijzZ2jfUDcb9W0BstH+NWaxJc2c6DodyiZ4ijDoRqXn0RSk8hecBP4tsOzmyQHADfI478xgL7+lF4Fw== 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=ZMuD0hrIlmNcv1wJ5/eZiYUAC8zAOTNfwVCXdxF0rRA=; b=edB6SgHesDFQ1s8gLcKouIGDB31I61ed7RWOS69rsnSTTESZS5zdIUMvpVBZ2Q9GmUzjioL8Oumj6t0ynl2IkOqJ0pFwUZ+JPo1gS5kwTfMTfGgEg4Ogz6m3QTpCvmQixwzPT+SZR6dg6rGokAZ4sqFDXaeVhCt9/VO+LsxAq8A= 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 VE1PR04MB7328.eurprd04.prod.outlook.com (2603:10a6:800:1a5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Mon, 26 Dec 2022 02:38:46 +0000 Received: from AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::ebf:5645:b490:166c]) by AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::ebf:5645:b490:166c%7]) with mapi id 15.20.5944.016; Mon, 26 Dec 2022 02:38:46 +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 v2 2/4] input: bbnsm_pwrkey: Add bbnsm power key support Date: Mon, 26 Dec 2022 10:39:40 +0800 Message-Id: <20221226023942.1027270-3-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221226023942.1027270-1-ping.bai@nxp.com> References: <20221226023942.1027270-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR01CA0147.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::27) To AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8642:EE_|VE1PR04MB7328:EE_ X-MS-Office365-Filtering-Correlation-Id: f4213108-e172-407d-499f-08dae6ea4f8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tCYZoaJI5rI3VZliVd35WwMdqDHyB2QgQloqLQfvEH19GxD3LZhdOYa72OojUQYBlFmX1ApYI94+06YEFKCb8RgtpcuQ3azrZzEfnm46QwGxCeAAhpuXWvhgbd6io2thfEIgEFtqdU+5Z8s8jZlLGR4ajO6Ign5cfct/90sF6fCpCd8veWu55zwAGwhZBrj3FNx51J5d/x6VdIfzvK1MB4wUYfFRviTWyGsIlznwMnVRYALvSLFjn1DRGxa6aQO71RTZcgnz7Rgh89wPGNQv0hkj7RS1K9Lqi5nVj8rEETdqRRhBNfMpDX41stuj0WvCInKMDhl5F5ToWcV5XnuCx3Qr2Znum9CkXzF/zmKSV/RNn0NpJSBqy++PMR0YKK1wfmKQ2giLN6j6abah/v1QHrQexqSEcqHrnLb0cxW4g0xmaXp9nkz1IF4dsEuBgTHQkkeBPEtkIpvTUaaCgVeF8ckB0tuXHVAAuQANwgK8EufBwZ1M0XnN+gXRKuMvOE7962XNeck5CRMOQ6S9qjCJdUdL7MDVbDQTJjur3wIBhJNt8XtJKILOF8/IOqUj3oQ3sKbj3T8rS1Dmz0Dmdoox3UoyYb6OpyAnwMtuaNwaooavTpuCO2igqFr4EIPgZVM3L0XF3ys5/kxWPnrAUqwHs2t6DoN4SJml0JykQHj7whzOFCCD2P2pvmfhxcC4oUUp7nnWyy1SbEaqcsRtyo+FQQ== 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)(396003)(39850400004)(346002)(376002)(451199015)(478600001)(6486002)(6666004)(2906002)(316002)(52116002)(36756003)(38100700002)(83380400001)(38350700002)(1076003)(2616005)(26005)(6506007)(186003)(6512007)(86362001)(5660300002)(7416002)(41300700001)(8676002)(4326008)(66476007)(66556008)(8936002)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aLU0AwWtWg7YKpb+RoZoruxZvJ5pelgPxk8wgs2jOsN1weFfqszbbhqDLQPManNTw5Nr7Bv6CTNy5RIdBxyRqFKXK1LkzsVKPqHJJFkoqY7olvJy+rE/0817MYZSfzQzdZDUoz8Od7ZBP4ax5x5b9CCucUa3Bgbj1BRwncnwqiAjfd7S5USnU3EoV1N3P0WWuX27YlYZzfEruzGgHlAHOLvsHvUk2s0EG2Am7VxfqklkXhrdWjdNiyU11WUdMBa4GjkR4QeL44QLt5jbHdTP5h7VYvv6gHtELCHQSi1YchZa2j7pIxdcwGcBJmskxO3GdVI7oZPQR0R1mP6867Vx/ncYddCFX+ZLIHA+vxFxcMZRevIcS+czRdqVaYXINyqZhxHhObRqJsAwdEwu9MuLfl9thZBJWxl2++RDLJHeIZXRetCU2OOhq5qOvCov4SONh/BQ0K0jAc5M+mAapAboHMLhbyrHobj1HpYdO+hTXd8k5Q5LM8+O55xb00Y+pTpjd1QH5CjV+qgT6zRr6w/7M2beOwxomRBypn0Qs8Ysx7zZSBq74Gfv7qLEIXzPyX4VBHyJ8aokSpVXKi1gDB0nHe3Jm5Yk/7yom94ibMBkPfyR1gsUbEiTF7/ySXCWnah7xXEdNfXK/vBrS5lWTY8NHvVX8x964Ypmzjc9B2aoczLui02CH8IqOvM3KMrw+bRggyBr3fNnVujb1ycMN4+ALct0BIkIk84+M5JEHjOv+LY4Af98vzRrPQsmNaderwTDxhnJpyyc0+QnjZvPLocE1W2UgayShyNghkMOs/Z3exJ9AB6+e2yfaco5sB8g9vvGe7OZc2xUeFJco1D2IuTH2SV56fiGzjGBn8YU7GtU5ZRcGRfQc6y8t6hzNwqF5djatdyJ6FX1+8Ll8CbZF3bFyHUnmPv/NMaQNu7a48KA3HU6UVm+ky1OTtTu87tc5sA9bUbOzetkMAbYCUWmRwvRLzf2U9vXYt2ChQlt7nIN+XbbkHx3T+Xp06T/NXI1siU5bvD06d/jXI+pLdJkwSYgs8Ft6tH2IJYZ1holPPQmO7TrDyAgh1QoRq7oCZoVAQbOId+ViayHbW+Tb+O799IFWuIzLvST6xWAQp2K4jR0GzcH9duNjTc0tzqRG8nu6zddr2r/vd5XEgVh/xTKGtuSFhLbLBWhHgTuRSXnu9BTNlv8A4oH8G+yczNJux8Jwk7sVVXb25ZsLa3MoK4oxCV57cGmNrCu5kktATCilKFTT1fnDQ++w9ntdOgOhAtDD+HiCbvgl8OmYzTo5gKlUMYx1SZjurbaj/E/Xlmvk9/exLqTUVDcjj3NI4cFe0q711nWWGBGeZooT7wmrM7wxIZ+mRdl8FfEhtWOcLYtldGOw2A4klTu9lEdRF4qDvvARAMQ8xy0AsP5a5fL6/DudCVUHQYMYS5DHdkvfrttcnglS/nO16EdIfQ3diHSh2Z+DeKabEQQ0bvynA8vdj+t/JCXTONDWOPpkvPlGBt/VfdXOeWGMEBThn/FbjAJLOKjcnprYOekqcxfJzRTWoMehSbiH4korqXVp0i1MIWcuZo95ELqZXrV3YGqBYlOZwWTf8M0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4213108-e172-407d-499f-08dae6ea4f8d X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2022 02:38:46.1468 (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: 5CHIZiXllDUtMXlqishVsD9XTcLE46p/wDKGgyDj40zJlKseUGnEDozkzsIrX9YEdprSy2kVT6r4q2NO8b3HHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7328 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221225_183849_833931_00119F4E X-CRM114-Status: GOOD ( 29.37 ) 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 --- 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 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..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..2aaf44f9354b --- /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_regmap_lookup_by_phandle(pdev->dev.of_node, "nxp,bbnsm-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"); + 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 Mon Dec 26 02:39: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: 13081575 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 0AEDAC4167B for ; Mon, 26 Dec 2022 02:59:07 +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=XmBEVb/OICGsI275P0ZVPURQu7Nqs9bCHJht0TtVic8=; b=mUzuKqxCronusx zgDuRymO9B96B+6QE+N5THCyF/vqP2neW3SZNu9k0AnkvzZ8mAIrt0MXWbefK1S4YTMnq0OHDXQMV 8MpzPD43DE8yMNkZv99dHbbGqQdfFTk6IqYPz34CEuFTkXdJZezJqSBMBGA2yjF53+xGFQ7ECu7+f 3MF1xVOO8+7aZt7nZBeIhPBXtn6FmLb6Sus7bQx/zTAFsf0NnsTi1CxXnicCxe/vfjU42xhKxaTer MMOoAui/31U9Qg38Lp/wVUbeQrwEDzXnwkH0HL7AgD240gbdHYpMld4XW3nFIWN4fphbUaa7WagZ5 sqBY0LqED72IckOBEqow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p9dgL-0017CE-SA; Mon, 26 Dec 2022 02:57:42 +0000 Received: from mail-dbaeur03on2042.outbound.protection.outlook.com ([40.107.104.42] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p9dOB-000tao-7F for linux-arm-kernel@lists.infradead.org; Mon, 26 Dec 2022 02:38:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xr0V4UQNBiI05ok25bICZQv/sLfFslSkWMMRG5RKawmcxwrlLZb3IoHakL792wJIeuyKIuU49PAOj2y9L6s9OzGOqMPnWyLc1KO8sVLSj6H/ucrmwyhsfPEkXx52uKN+orgqSDoJOQVkpXqiIEMUMVR5vNqNyrnEfNQkrIBMws/Xamzoyu0ZyZ8ftR/YVjgS+mDXgVj3wcavEiIvyyFHrYiD7TyeYApENTcyODVCKQkygZUL/lkqvnCIOAI9c0O2YZCJHW8bA/Z/h2LUhYEX8YQ6iro6pe3vkIfVQosmLog+bDgM7qBxLiqOynoKbCrubgL6WFT+/t0Bcx+HdEarcQ== 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=k9vT1ilF7EFgAGaLgspeMl9xSWYLglvZYVsb0C7T0XE=; b=HCqKIwa+HapOxtz+H3Q5v7wp01Ch8GAjzQ11Z/01AfLUvqhf5eD1TF6Ep0kYPFhFuNZNm9DrLB2FhSmnsdFoqKHVEgQ4DMECeE65H3/5djPTafRrUIinyg69eHdvoQWIQLnobOggdPI0r8K1mU3zsqC+EtYimau+g4XvUMQ1vuBu44M7M/c/kLn1K4dR+UuUn3lJN8OvRDp6fj6mHHg+9oQkSiuqqGKSTAaksZy0Xf83E7iERoFI6kMFJfEaPHP7y1oZmPvqAhnN8LZ+mC8KzbIfdTH3x4uZFISQ6bAUN8QB3ssMGl4EAFeB9FqgiTnoqKe/YntspqNi3SiuQGAGGQ== 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=k9vT1ilF7EFgAGaLgspeMl9xSWYLglvZYVsb0C7T0XE=; b=IyxvxTPYOcjaiQ3F//o1oErNSce0OUwR3cOVn3l/xcQPDjFwqK7tmQyBEb9BAJiuPG0FXi7Lv2EVCH8Y6mOeCHC7aIkpbXV8OymymWTuUl3cCHGe4FDwZItoyy47f40HnBHSoEhl5ZEwbHBIhLz1KAOMH/GpXGCC3Kn6SWiOOyg= 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 VE1PR04MB7328.eurprd04.prod.outlook.com (2603:10a6:800:1a5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Mon, 26 Dec 2022 02:38:52 +0000 Received: from AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::ebf:5645:b490:166c]) by AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::ebf:5645:b490:166c%7]) with mapi id 15.20.5944.016; Mon, 26 Dec 2022 02:38:52 +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 v2 3/4] rtc: bbnsm: Add the bbnsm rtc support Date: Mon, 26 Dec 2022 10:39:41 +0800 Message-Id: <20221226023942.1027270-4-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221226023942.1027270-1-ping.bai@nxp.com> References: <20221226023942.1027270-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR01CA0147.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::27) To AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8642:EE_|VE1PR04MB7328:EE_ X-MS-Office365-Filtering-Correlation-Id: 6dc9a596-0b06-44b5-d7bc-08dae6ea5346 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IFFfnFJEocKQ8MOHYQOvQsF7Zx7EvQrUfBhst1jKs431PJHeJfyZNtAH44PyORQJMfsd+///LvvtyCWvtv1IcYKFaFvon7mntpA6LGLazdr9ZDepauzDfMKNbB3qaayOSL00scbUYzdZWM+aOw1XrdcJ6bmp9cmLQ3FMG0xbGgOtErWp8lMJMnwk8aVsqJQUW/VyubZslm+51whXwYwhBKpvXHCRFhy9fYw3dBM7dRV1QiL7tvNqb5RAS3KnUb/S2pZII/H+fvQOaj/Zg4nalo3ILfJFBsHvcLAS/xU1PYgeHuhPk+DRH7+rVTIMgK3B1PxB6HJ0HGQcGMKpjERvtObdmmQdaIIwuexr7jDe1at1M7fWIkklZxuRZnzFUGen2h7N5hUghleX+Ih4WoNGiAV7MuRctduhENJ4cKq8F6F1+uvc4jRvBKNULeaZRGYHaeVyb9ijwcq/RAivMz5LW9H6pCLVwuS9tFsMFBL55cFS87om7juhGYGL4PHBm3GGz2rotwdhXGPTbtc6rbfowxFR/qsYlWz5iQlg5QX+jwgg/IlYA8A4UHnr6k3Zh5LmFUMQbpj49TEPOaCN0qOXqLuP3f8FaeljDpu7luWpbHwXnA2yb1QKAgp1A1tzwzCnBJ1NVQfPtGD95C0GItbv1TrTO/4AA3pyBaCTb2QK1EZk0b4Uk8NeizZV461KLYnr/QVTC6r28YJWwE1gGlfQqw== 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)(396003)(39850400004)(346002)(376002)(451199015)(478600001)(6486002)(6666004)(2906002)(316002)(52116002)(36756003)(38100700002)(83380400001)(38350700002)(1076003)(2616005)(26005)(6506007)(186003)(6512007)(86362001)(5660300002)(7416002)(41300700001)(8676002)(4326008)(66476007)(66556008)(8936002)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zhRptRu5b6ag4cfdmowkUaXJagT2bDpHV/oc/m6UIth1bFJ3E/EL6KeR0J0Waq8tWOhW5TUfxhkT1bzmdxM5DhSjI1WDkN7F+n1Zlw4jAcNc+uuuKFAHXIj2AldBP60i1OMmOTgTIfP69YMfq3fY4IagUqbU2vCmpCGhkB978YYXqgddHlAIHLSxU85oi4Kfe4rBL/vGHg9HfDd9AyMo2Zf26AbkXUe+Mv9cqs+OHasVla/s5UlOllmWTJkmIZvAxZ1rw/P71Jctzk4LkD0LdhvfNnNQkIAQBJDmi2ppMteiBMTm9ipDWOGOkPi1ViZgdebD2xU8BNa9e5kV1Jt6Wi/8lu+4CQYow6Nhrk1Bg7gKi//xrl22xkPE49OCyAVWtkWnY4VUvTR3DSbOnUEaV132XGaK7CjIU45sMm9jxGt6Y/YU62vM/doEBp9w8M06GVkqLI33pznlELhs3T4vu+yj3wWrme5bWLq0Gn0rGmFYXw1ttloI1vABigc6NSTeD/Robt4QFwhJOzyYezdNkxsvRHVCy5lzD8MppHd4RGahPmn0LsbysuaIC0AN7+RW5R2UaZaRzNDbRXtLf7TRBHsy9sK57DiIlz3OFgGSEchezw+BkTZUTakIkCJ5/2HK9wTaxOUy/UPlDBzuT+pXUOcMzVphPbxf4IJ1vrKaaTBoGU/no7ZaA3DAKe4qLQdDEFToCT2WQ5npfkG2QVu6B1tEM35a7Yz2nls5y+F2/DdAnKm9EJcsYm1gHR7+tZTCSisuFg+uKR8JB4loOWR3A2+rZdS0657kELDdgYOHorJlA8VX4AN87FOhoxLedZ1KyuOSeG3ykQMNP3WjJPpDXNKRu9I0vEu3z/Y5rM8UXmRJfVWmiwYShtzdiTL2BRTVFogph+9sr/ZAxN4/p/k56X33fXphZbBnEIiQw3qHgwjKoQoicPnNaUb59JAK4ZhraQKYyUrrsvFMupATlPNd+GHlKTH60xsFJYFJqcznl2GbnXsSLrfCKbIgodrPRegkCYQZOdhKMVHBpr9evK8cNU0KyKKzvm3DpuMNzmTY9hIcbwoEQd6frAX6U/RAOERIoAO02Io/i7GxTEt+Faa+lrr+Rz1kSkf9i9BH8YJ6ZNP6hK6+pXelXtlVLPXj/I4jNeQqdC+jdddPHKI/7RtNPvD0hTVYFt9UU/Ro2i7EOEVbda1qfS6z88gAs6dFv7s0vulq5i+3t0+Ky+jfq1vwihCuTWzdwlcZaWQJSRfVfT4jn8q5dxwFb8DdEccAxcFl+KxYS4GbdRvVmkUwtqrIF8kgPag0cWmXDt6OyOf2gUcMoLXu3nBpskCAAioxjZfeQ6gXRY3Z4Qxo48wpYkpWNrNDRM+UIyvNIMRuwPItP0KpbH/Q++ZFp255LOXWPzjrDP3zzwZ9AlfAf49MkAxsxGkWotb42H0k6wDWPuTdxVuEw5LnSChiV+xQUOjJ0Z+ImhOan+afXb59JTb9C7vNBFBfyu3CgHQw3VAhzX/V29U/ofomsqwz5ij4Frdq1keqX2T6/qA7mOnq/f/dQV/tivCNLluA7XomVyWmZqWPqqtyJdecgeHiodWG/IguZZ3n X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6dc9a596-0b06-44b5-d7bc-08dae6ea5346 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2022 02:38:52.2577 (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: Isd0o8wLN+7JvaKb8gYBay7ELlxlzC2biO+/6EsI1OMEvE2YmW3QzlD3LZqycgYrXYcDYvGEKlsHw++hFUq+Sg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7328 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221225_183855_446311_659D25BE X-CRM114-Status: GOOD ( 28.30 ) 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 --- drivers/rtc/Kconfig | 12 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-nxp-bbnsm.c | 225 ++++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+) create mode 100644 drivers/rtc/rtc-nxp-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..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..4704a7901341 --- /dev/null +++ b/drivers/rtc/rtc-nxp-bbnsm.c @@ -0,0 +1,225 @@ +// 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) { + dev_warn(dev, "RTC is not enabled, time is invalid!\n"); + 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 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, "nxp,bbnsm-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); + + 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 Mon Dec 26 02:39: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: 13081576 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 0A220C4167B for ; Mon, 26 Dec 2022 03:00:45 +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=I1wFq/oocsZqX9vUtcDNdQHP3+8jGxtPKUwA68MfTLg=; b=fiwDhQUplcEEcJ 1KXuyQu++GPLYd6MDkJRdONjMHX9K45b4HqKTKcKewY/2N3TE8BPtquUasuh42mDrLNOmRqduFvd4 Kt15qaij7MuuPPe+6JLv9oVAdUiNzNgMRRuSqA8l9YJK3PjBbH1CSiDdiCT2FAv8wd0fqKlO9Kp0l 8dniPKOV8RSc+tPrBw5gktlTnGXZtkHNtNKsCesSRXR/mL1FZO1aWZ7UPT3YhIVtjPdxPzMfMbdb/ ce67wYHLuTefbZQbydXjDOvjJzEjDkerzFHSGNtpGnoTRkRv5Uf0rJ+IxIjmj8nlBf0wOHoe+ZYuJ 8UL0GxnDC2iQOS1TgWGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p9dhy-00184q-Az; Mon, 26 Dec 2022 02:59:25 +0000 Received: from mail-am6eur05on2084.outbound.protection.outlook.com ([40.107.22.84] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p9dPl-000uVH-S0 for linux-arm-kernel@lists.infradead.org; Mon, 26 Dec 2022 02:40:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EZ080PzxlCdTB+mpXCZ5wKYgzoBh6InqXCAqIeJNsv2UlQJgrCFUdfrDZRo7+r70ufXRcdgayUXo6F8/VR+gMUtzKINvJEKSwXkbyoa72k22S33mkdESGHYEOlaz8YquWYxbXCMK38Guq3R8IenKKoy/Q3z8O9ikZBNbEsysZWPuYI32xuj4qRfru3MmN8X3zlN0lc8uK/qPTd+Yzr4wgiYbTalKEn30fAzSwX7y4HNSU0n+3MibMNYAjpHDxuDCnsvlc0iKsRN+1DROc70+y3RwtdK8/gcod59P3RuvmtPE/Hms4LqToWMsFfijEAphTDS14mpl2Iobeo27aAbfTg== 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=F3ANuUaZeHdjNh8mAtIjTsBv8P1s1mHWAJrMQk/TSdY=; b=dJcypKDva27LKC8b/cfloOiioX7CWfut01ISrHW0aw8gy++FjdeGusZsVisHDX4LRwCievIvxSUsFZsMj0Kgp3PqFriQVd69MZHd9NMtjh+6Rnj8+EMm+HtY4ax6tyDA27gWSd5MUiD/t5lDISRMBX6qJiYZegt9DiRsqpnvr8G3Y8B6F9ZOJq4f2+uiOct/OfGXiZ79brwXZuOdBa0cS6VR1AIDCIhOuSY4rlYnJIbMwSmFCuVGG0OmTaJA+OqoWp/Z9IfKYzzJ0dgiWH/K7dgBg54Y68Uf6RImH+ktT3YD0mma0rzn2PX/aEWvOYFXXO7I40zLSOdjk9DGw8kp6g== 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=F3ANuUaZeHdjNh8mAtIjTsBv8P1s1mHWAJrMQk/TSdY=; b=CZInMSxHxXblybKnFL4D4mQW2wUqw4pnbceRqo3c+Eg8ey7fdA018KKpMwf4oQfaopRYSoW5BjbzFQK+MGu3alb3i0g/UKTfUwa+3UtrC17BmKHVC9hkmRIL76RUd5E0glgp7Sw0z7t2OPux5cq3IM2jL2yNP5TNWWNA5yedTiE= 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 AS8PR04MB8344.eurprd04.prod.outlook.com (2603:10a6:20b:3b3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Mon, 26 Dec 2022 02:40:31 +0000 Received: from AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::ebf:5645:b490:166c]) by AS8PR04MB8642.eurprd04.prod.outlook.com ([fe80::ebf:5645:b490:166c%7]) with mapi id 15.20.5944.016; Mon, 26 Dec 2022 02:40:31 +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 v2 4/4] arm64: dts: imx93: Add the bbnsm dts node Date: Mon, 26 Dec 2022 10:39:42 +0800 Message-Id: <20221226023942.1027270-5-ping.bai@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221226023942.1027270-1-ping.bai@nxp.com> References: <20221226023942.1027270-1-ping.bai@nxp.com> X-ClientProxiedBy: SG2PR01CA0147.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::27) To AS8PR04MB8642.eurprd04.prod.outlook.com (2603:10a6:20b:429::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8642:EE_|AS8PR04MB8344:EE_ X-MS-Office365-Filtering-Correlation-Id: 278d0f87-1315-4fc7-8303-08dae6ea8e15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sQtywuWgRjlNY4IiL8RzS9HtZFb7Hx+gfnpRjFhivGBhDe2izfar9zrDoIQxik1pzsSZ3mb/2He6QUpec9wBFbl3Rrrdd7xVaQWqEJWAfcZ/IJEEqKV7dSFOBku6GxOSexhMzbz6+tgtC9CHsLfAheNEHLBQPuksgralV8094qSReun5cQcqpwNCMOPQBahAAMnDBbltm6ZIacAKW6xv8sSa0gp0oTWEqz/4sKiL/WClS3Re7D5mXD5De//Y4I9phb+96L9s/c3BYQcTdLigMvUNeeZtftNsfRh3VhMJm4Tohi94yQt3ERyklQ0jugVsIrOauq+EU9VAo65rmABCFNawZ9kgpNXVgG3797+oX7lBF9tyRiZBVi1rTFFQb1QdaZfplPcr5Z/hE7I2FzTtk0D7g9SN4w4SzysbhPNUmdWKPB99ax7tlLAZ5U24TDJoXistg7tRw83ZojZ4JlWwahLERCARLzT7DSMJ32heNwf3/6k7x6ZkRLzeNaQQxqdJD/FwRuIUiqVlcmSrdWN8rM7a2eGkPdjnE/1sljitgmLMuqJCVeg2/ys0351NZZ2mADXUFeEDTHA3v7ecQlyZWUCkIGQTYifXDToOlfVeqd+aH6DHgVf6lORfXtgLN6AhGt6g4bibtdFV3TnfjEiy4uQw2uuJ0sEzFNYargShHWel7+YF/EUB0ffNaR10utGPBS2LmO12Rs6KPlOcXNccsg== 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)(346002)(136003)(376002)(39860400002)(366004)(396003)(451199015)(478600001)(6486002)(52116002)(316002)(36756003)(2906002)(83380400001)(38100700002)(38350700002)(86362001)(6666004)(2616005)(1076003)(6506007)(186003)(26005)(6512007)(5660300002)(7416002)(4326008)(8676002)(66946007)(66476007)(66556008)(8936002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uG5soIEBJw8ZCk53t2FQi6zfRJXKl5PP68dy3w4epBWe43yI4fscayAq1m2RC0106typchT+6eyrbZHzkDHw/xjfupWsVcilTtfv/FB0bUBeuBnGPD/dr3iw8vfwSomq6EXjwXHJBPwyHsVsQHpgobtnEqRzN0zR0GXbTf1D0r1qJBRgUd6xOsYxvtXriUFvQTkPdjrMTg1j9d87Jwu6eIyfgLXhmdT3xsmn71Z2cYeVn52jQmXLtH95AuAdc3DMxTiNKf9tBXK1Rcn/hG37iGTlMSGi6XisFqovubPu4Bgn2jboB7rs/HEodOzJKea0BWNVsQSoZv5iWIEwpLtcb/IECbCsdXADDJrnBhrN65eJ/CJhooc0FQZ00hB73DbqY2gen2IxiiYgMDAwCBL39RzE7A62UQuHvRioorL2pk1JmMpVRniBheIPpFH/fvkdEMAJ1I62Oetqrlb10zZ/ZMUBdOwodA6yFj1EQHT4XZiOZblB3D5qMvVJdOF6R6B1N5Ix0WLwmpdrigci7Gvgvh/MA1X07mGaioGwrsSq3uibwd19S+IS+N9Id3L8R28vvGQzHk22aiFErxkJ4woYRfViXKce8PxYyOvSKD2AlXVxXX9MjvvBuyb9rmfgy4wkwDjJvGoSVnSCF1VzeKae92l6tBAdDLBQK0Tc9e4NDO6K1gQMcahc52KV3gsexaY5aKQ0RucMorB33UAolOWIPhP3GegVnPCtMXPEPH+bfFFhJfaSIzTByB9vTyGjvR1SVHhPLv7TXaJcyVLsmquqz6S11031P7slzp0b1rtnTSZGLE7HRbLjFmiiaAm3hbRugtlkRPNzzXJKum+68pcNgr53qOwMiJStG8ONXBmW0qOgsR30ubFjNZ70tiO2zOJvDUlPf1mixxc9pQ7Yb/KvN56O3nIwfccFsN/4+w0fO/MS3gKQkr0QeGeNqujeNtAfY0MbJMP8GXdz+87F3WRqlOKEJzAVAcZtKNJmyM9mOXzU5A7m6hrmVRfVKuC6+HyGCD07RCPb/oGTtSZNYxNRVOSSMJhp2IXSRWticNjMBAGUjJ1kOgrjSZ8PEXRwMIRm4XL9xjL2UgecYZgSQ1z4ljsFJ1UVvrV4OjR9wC2NZCpkD6B5985VbEALFDfmefTqF9bt0E59/VjmDscuBFXhz/kEO0f0sshcOzrFZ8VvmNs84S+2c8/KRRwPsrisDsPzyr1VeXNdfgN9n0cykFUlKFgWokQwBQxapFmXSCkKMpupTNyBJI+QPUP46ME6TdLgj9lSYZNCATnmuu1ULCHvi8AyBwgKACZ357sPWQZW8xfHSt5tfsg62yxTaa31V79XxaZkiq+M2JPtHxT5vcxRdmqjbqMHt5N3wQkA9eBnxbtgRLhs0Xb2Kc6ViwL3ruBfAXJQ0sz8mrfqonPyxx5OaSqMh4W9feF8vy2uzYQXg0xYgBr4zKm1Ka/HcYD/ynFg60k9Mn137g/BdQ/wDRzpvgN4jWHGlXZSyscqhuJHVsy0uQJu3kOUVi6aGJh0vjnelky7ZdyWqrjFCAU4Gr48hFBi5Gf70f1kpf+kc5CBneVbWcWR3sxO45y0fkMQm5UG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 278d0f87-1315-4fc7-8303-08dae6ea8e15 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2022 02:40:30.9649 (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: rtevXXXhV/ChF0RFA6OblzFVJHiAAgRlPoQTXbwD5o50r5ej29Lnw62qa/+KPUnwuuoRWl+Ws+vp+qBDZI7Gtw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8344 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221225_184034_036282_84DB2923 X-CRM114-Status: UNSURE ( 9.04 ) 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 --- - v2 changes: - update the regmap property to align with binding doc --- 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..5d7cf2d99444 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"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = ; + }; + + bbnsm_pwrkey: pwrkey { + compatible = "nxp,bbnsm-pwrkey"; + nxp,bbnsm-regmap = <&bbnsm>; + interrupts = ; + linux,code = ; + }; + }; + clk: clock-controller@44450000 { compatible = "fsl,imx93-ccm"; reg = <0x44450000 0x10000>;