From patchwork Tue Jan 17 13:51:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 13104671 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 27529C3DA78 for ; Tue, 17 Jan 2023 13:53: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=0PLORmksJ5yckKSQ/gB6f5f88enxGsZ3q0WGK9SJ874=; b=HYlNu6Qfpx4LXg MhYiUmTHX4pOiZ8eP9BlZ6nujv1I3G1XRl+Hhtd5ef3jKlI3ikVQtBhUsivI+Zlpc7tAz0Mp4ZTq4 t6UprwxtyC4moGT24r5nQo9V0MQAru1ZChmEGctn69dv46PRUnOGRa6V2nru7uYq8se7+Qi37WH0d EEi0EwHeBsOssqV5l8+TOjGQEOlpxxqup2RZorEuGikddg2IDCd1YL48T0onFKJTDZwoEE4WdUPOZ ZCz4N2PzRI7HL54o0v/DJdKYP0FpCMgboNG7cGklPyOX/hdeINUTYtrSyygQo3vn44fDRk17iyteo tT6MgyX9/UTtyCs2hjjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHmNb-00ETVG-GE; Tue, 17 Jan 2023 13:52:00 +0000 Received: from mail-db3eur04on2047.outbound.protection.outlook.com ([40.107.6.47] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHmN2-00ETIb-6S for linux-arm-kernel@lists.infradead.org; Tue, 17 Jan 2023 13:51:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BN2M2CK0v3H3K+HsHriTlhzKOK75PDqqAN+HF2QT2T14WPPkBvo/gqN6MLUlYO67UvuPyE3M3+4pe5Jz/vHZALKduqF3mldtC7TbRmORTunx5ayrvGF3Vo+konExSgZwXnOSXK08IAroircUZIOmQATOeKad1kesv+m6vjnhiVHjlzwtfMMl5XUU/mT1U9CBO9KNelaWxIILqKSYs16VZdiVJf6Ktze+GR4zT0DDUbYypqx+FIxSOoxGBtv4JZ1Ljf3eKiNdqxNXEu2LnHoJztrAmnTzGnX4oP5SYdmNYdSsMdXmDYCaJXSAzFcKVH38J8dvzDF/yF8IsKMaQPPQaA== 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=B6o46xZb36OyUJXG+I7j5Jf+aUrYcnwdHYAVhjIMHbI=; b=Tc6PDsaeUHv5Gz3NXqwC/fRa//04zyh9edmNiXavWzf9rjHP/lYpO0qsd3koZeoM6RnQI3MpVNobVW6ojX4WZ3uREPIt2AveJ2KjCd/8JoYEGySe+kc2x+5oa/+0ITDGBAjEXOAWtLghvVleZKh2hUDJWNnwTPQrhiI4FovnjX+s8cIvbblZ408jZvHY21Sm38TmcGpqsQrwgzyPZmGqoa4rgOTiVNGdinlea9TU+M7MxTPcxd56E5oTiWFqviEwW8AArwBs5MCur9e7BJc1y6SMrCc3oS5iHw/iiwZMoklEAS35C8bnmn+f6Zk7q/G8VzXZGuYAQsDlBy9pzL8TuQ== 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=B6o46xZb36OyUJXG+I7j5Jf+aUrYcnwdHYAVhjIMHbI=; b=I2ooudVnYQAp1T3lm0ebQ6FRfcrTHFhcXT2Gi4fkaQfISZL9j8ZMmGK/8ZRgC9+jQP0onay4rJBxXFlB1sd71MwkID0wMGOKlUU+7oh1igb/nxg6N91HdwVfLgLASQhh/MFzHEb4gnYWFRHfRCX/DxzdS4hs7jRhfPsp3xcNahY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4010.eurprd04.prod.outlook.com (2603:10a6:5:21::30) by VI1PR04MB6909.eurprd04.prod.outlook.com (2603:10a6:803:13d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Tue, 17 Jan 2023 13:51:18 +0000 Received: from DB7PR04MB4010.eurprd04.prod.outlook.com ([fe80::7479:76ef:8e5:da0b]) by DB7PR04MB4010.eurprd04.prod.outlook.com ([fe80::7479:76ef:8e5:da0b%6]) with mapi id 15.20.6002.012; Tue, 17 Jan 2023 13:51:18 +0000 From: haibo.chen@nxp.com To: jic23@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: lars@metafoo.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, haibo.chen@nxp.com Subject: [PATCH v6 1/3] iio: adc: add imx93 adc support Date: Tue, 17 Jan 2023 21:51:35 +0800 Message-Id: <20230117135137.1735536-2-haibo.chen@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230117135137.1735536-1-haibo.chen@nxp.com> References: <20230117135137.1735536-1-haibo.chen@nxp.com> X-ClientProxiedBy: SI2P153CA0016.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::17) To DB7PR04MB4010.eurprd04.prod.outlook.com (2603:10a6:5:21::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4010:EE_|VI1PR04MB6909:EE_ X-MS-Office365-Filtering-Correlation-Id: b76cc42b-c04d-405f-cbeb-08daf891e84a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 74+a07wRDjd6CYK33V6xfeu3Vt5B29NlMgyJi4EIieXfoocNTLH9A0GANHFIsY166+XKY5OHZ71/WJGV89YClC5qZZSo6fqXKiPRJbt/ezHISMf5jmkBRFoeoBDAWm1HY4EcrE28BP6BV0H0KFs2QJN15qmPd4yqwzD4LIC2gl78pCCutwdwJri5V8igu5O/N5GTfVemIgdEWa2qkG9F8xx8J3WzWroNp6t0vokJHapsvhxneUg3/Fzr90b+ylzKHpFaacQLHZ8X+ZbjTlLHfaNhDwKeaCzKz1WqF6NNNnaSwGvzsFcUhJLz60GfavCoi6Dc7Ihd3iBF6CDNqRBbiOyILPjg+Yra5GjDHrl1TOAzV9c3NC2VWXizwn+3dYRYOvJobO9M9Tq+pAVCw51gZUMoXhWp625hyDI7ZirKfOoZ9qxhz0lvtkuLxyenxwzmv1Jkg1r9ad1Po1RK8205MDeumzhuTWr1ugbsYmAJcvLSKJgFaryrnQ4AQZ16/NiChoFSd/jLRZfO0UfzzOFrjPWJo0HHhAerQw0YGInGxqZAjyKluzdPZY2JKzT8giEsxb2JVLJMpCTniFnj2Fv+DNszzmiEFrTBLrFEFh+9aZLq31Uo1rVbhFPLVwcWipRe6gYHC53d/90Sfopfx2wqfln+GqXNU7R2R1th/LE779SzzVB/ftpcpWFK4uQ3Qjk3R32JvBx/e6NbGqM6YvzdRQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB4010.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(366004)(136003)(39860400002)(346002)(376002)(451199015)(36756003)(86362001)(30864003)(66946007)(66556008)(8936002)(8676002)(66476007)(7416002)(2906002)(4326008)(38100700002)(83380400001)(5660300002)(38350700002)(316002)(6666004)(6486002)(52116002)(41300700001)(478600001)(2616005)(6512007)(1076003)(9686003)(26005)(186003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gTuxsj5E10NPfyKVioHcwF+Yl5585wrblHsyQtff/sKX/LavgKJmgTiGNltAx2oYIqgRlEYl8QxkjNivFwj2WfOvG9YEZjJmuMRo+GvbnofyWhC6+KiwUOmv4kqBV+WWpcBL/1En1Hqo/OX/igk41PkTSMHmJslFzT8cX9Kh70ZA8EzW04nnqk1dn+xFHkAQfDJ/lwYHti2G79ZCHG8azQyhhpCWlIZjHdZnKzy65b0gliOCaIQTagEmFgDXRKuGsvyTuOE7IphqF1hfxp3kLAEuPNn/aSjfsNxLpujOIhSrOfPvYZxBY9DsNVM6evXbXm4I6ffSugPdrhWt/tPDlL1ot40ckjZxEb36rtnP3xUAcjP+HhQKKOgCHzEf4v7p6NE3fzf+RUdoqcpeddAhHlG+s+kZrBAADO5K4sqkMEcHeDfkS61sboKIDU951YfQa1QDVAnOZRS0XRnqaaVNi+ecCc31xnZQf8+oi16McegZoc15gL3Mt/Zc+LPAmQe0A8noYTlsphhVYg00OJwOB9ZhQHoqP+d5EluR+nnlcURMLUSU7eta+4glw3ze8x0lIAqzt2OVOOKHaiuQ2xx8AcegK9dKytLeBIH6xeXjxuQj0TsXWu56xEzAUGTJGmZfyNCeUX74ecJwrzJBS1LMrY3AqzYusrmESP+DzW8ro5IIDCYo1sRv7i2nUOrauTr8q1pdEYr6B4plC331iLN5D9tEkEXdUASIXcZaIqB/F1M/YjjhxZhxqlABQwsRZkiCEzsXdBsCw9YmdK9Krnmtkgje+xlfpqrAtuxsILLaVoi2x0kDn+GRUsP6fwuB/aQuOJ1sAIBiMfhGWVfXtYNU9t0KC+mob1WSQM+Vvl3aJUE6rZMenFsu+8Beqswem4QH+/B7ZAvxE6A+/2oN9Eo8ad2j3Kcys3c3TcMhERnMVKrDYwdJQvJYZq8PHFJTJ1EYcm9ERmKM4a5VTPPTC8LdXAS1xEsdjoXlYepQRHHt0armCvKXg82m0TApH8Inl5pb/ae+nxxNwczMfnq2jkgwMo09fv6unv30MrhEgPMxDgpgIwFtEkClyO3mKlesqGA+p0Tr+iwYewmcu9TznjAhiXd48EH+tshfrxYMOGt62r9AcjcNpf0J5sHLwl/OWZ8Q6yBjyFYhVTNTNYUtcVVwQEz3BN9UGzpN7XzPhBLTYtpBje78RoBxgYorPYr4h5+GfDAl3/yQiJb/3neaeLazN1S08ugj0lgeeYc4KWS7GpAACIyi6weAfoTYrobhfrA9HdpKCwV7cyTtmdk+UKM2Z/ZaL2jl+Zl/sqCadVFC9xPvt2UbEm0bjOY0QrF+3XgdlPzRnxNVaLHjcjcnYLzgY5xxyAfTKmS2d00nfT/fNNOXIrkun2sz7S+I0AD4hQG+W1CkP1OiAktY5uGK/Ly8xq4g1CJgodNnh0SKE8Btplygj3B8loLy/inRSJXfYjmJRsWipn9C6Pjblk9fDOld2rHdL2exOiEq61AWzx7W895g+X3y7RVjDFv2SQZ++L0jmiF1jI0JSBAOvygBWfj947V1y5A9IGTAUf2DmB0ulUyej5QtmmGxRj05jZ/LkCbS X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b76cc42b-c04d-405f-cbeb-08daf891e84a X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4010.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 13:51:18.0321 (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: BblGIz7AWFrCWKMurYL8jzv1vrqCFTarLQLI7rOlfIYfmNRRwHR+xajBDJwnuQpHWClCXiCe8+bJvu7vW9fa1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230117_055124_315152_B897DD47 X-CRM114-Status: GOOD ( 26.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Haibo Chen The ADC in i.mx93 is a total new ADC IP, add a driver to support this ADC. Currently, only support one shot normal conversion triggered by software. For other mode, will add in future. Signed-off-by: Haibo Chen --- MAINTAINERS | 4 +- drivers/iio/adc/Kconfig | 10 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/imx93_adc.c | 484 ++++++++++++++++++++++++++++++++++++ 4 files changed, 498 insertions(+), 1 deletion(-) create mode 100644 drivers/iio/adc/imx93_adc.c diff --git a/MAINTAINERS b/MAINTAINERS index 31ffd4b4e90a..0a9e1da216a5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14870,14 +14870,16 @@ S: Maintained F: Documentation/devicetree/bindings/iio/adc/nxp,imx8qxp-adc.yaml F: drivers/iio/adc/imx8qxp-adc.c -NXP i.MX 7D/6SX/6UL AND VF610 ADC DRIVER +NXP i.MX 7D/6SX/6UL/93 AND VF610 ADC DRIVER M: Haibo Chen L: linux-iio@vger.kernel.org L: linux-imx@nxp.com S: Maintained F: Documentation/devicetree/bindings/iio/adc/fsl,imx7d-adc.yaml F: Documentation/devicetree/bindings/iio/adc/fsl,vf610-adc.yaml +F: Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml F: drivers/iio/adc/imx7d_adc.c +F: drivers/iio/adc/imx93_adc.c F: drivers/iio/adc/vf610_adc.c NXP PF8100/PF8121A/PF8200 PMIC REGULATOR DEVICE DRIVER diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 1b990bd658e1..af4785dae2ef 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -566,6 +566,16 @@ config IMX8QXP_ADC This driver can also be built as a module. If so, the module will be called imx8qxp-adc. +config IMX93_ADC + tristate "IMX93 ADC driver" + depends on ARCH_MXC || COMPILE_TEST + depends on HAS_IOMEM + help + Say yes here to build support for IMX93 ADC. + + This driver can also be built as a module. If so, the module will be + called imx93_adc. + config LP8788_ADC tristate "LP8788 ADC driver" depends on MFD_LP8788 diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 6e08415c3f3a..df8c0f26307d 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -49,6 +49,7 @@ obj-$(CONFIG_HI8435) += hi8435.o obj-$(CONFIG_HX711) += hx711.o obj-$(CONFIG_IMX7D_ADC) += imx7d_adc.o obj-$(CONFIG_IMX8QXP_ADC) += imx8qxp-adc.o +obj-$(CONFIG_IMX93_ADC) += imx93_adc.o obj-$(CONFIG_INA2XX_ADC) += ina2xx-adc.o obj-$(CONFIG_INGENIC_ADC) += ingenic-adc.o obj-$(CONFIG_INTEL_MRFLD_ADC) += intel_mrfld_adc.o diff --git a/drivers/iio/adc/imx93_adc.c b/drivers/iio/adc/imx93_adc.c new file mode 100644 index 000000000000..d8de8284e13d --- /dev/null +++ b/drivers/iio/adc/imx93_adc.c @@ -0,0 +1,484 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * NXP i.MX93 ADC driver + * + * Copyright 2023 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define IMX93_ADC_DRIVER_NAME "imx93-adc" + +/* Register map definition */ +#define IMX93_ADC_MCR 0x00 +#define IMX93_ADC_MSR 0x04 +#define IMX93_ADC_ISR 0x10 +#define IMX93_ADC_IMR 0x20 +#define IMX93_ADC_CIMR0 0x24 +#define IMX93_ADC_CTR0 0x94 +#define IMX93_ADC_NCMR0 0xA4 +#define IMX93_ADC_PCDR0 0x100 +#define IMX93_ADC_PCDR1 0x104 +#define IMX93_ADC_PCDR2 0x108 +#define IMX93_ADC_PCDR3 0x10c +#define IMX93_ADC_PCDR4 0x110 +#define IMX93_ADC_PCDR5 0x114 +#define IMX93_ADC_PCDR6 0x118 +#define IMX93_ADC_PCDR7 0x11c +#define IMX93_ADC_CALSTAT 0x39C + +/* ADC bit shift */ +#define IMX93_ADC_MCR_MODE_MASK BIT(29) +#define IMX93_ADC_MCR_NSTART_MASK BIT(24) +#define IMX93_ADC_MCR_CALSTART_MASK BIT(14) +#define IMX93_ADC_MCR_ADCLKSE_MASK BIT(8) +#define IMX93_ADC_MCR_PWDN_MASK BIT(0) +#define IMX93_ADC_MSR_CALFAIL_MASK BIT(30) +#define IMX93_ADC_MSR_CALBUSY_MASK BIT(29) +#define IMX93_ADC_MSR_ADCSTATUS_MASK GENMASK(2, 0) +#define IMX93_ADC_ISR_ECH_MASK BIT(0) +#define IMX93_ADC_ISR_EOC_MASK BIT(1) +#define IMX93_ADC_ISR_EOC_ECH_MASK (IMX93_ADC_ISR_EOC_MASK | \ + IMX93_ADC_ISR_ECH_MASK) +#define IMX93_ADC_IMR_JEOC_MASK BIT(3) +#define IMX93_ADC_IMR_JECH_MASK BIT(2) +#define IMX93_ADC_IMR_EOC_MASK BIT(1) +#define IMX93_ADC_IMR_ECH_MASK BIT(0) +#define IMX93_ADC_PCDR_CDATA_MASK GENMASK(11, 0) + +/* ADC status */ +#define IMX93_ADC_MSR_ADCSTATUS_IDLE 0 +#define IMX93_ADC_MSR_ADCSTATUS_POWER_DOWN 1 +#define IMX93_ADC_MSR_ADCSTATUS_WAIT_STATE 2 +#define IMX93_ADC_MSR_ADCSTATUS_BUSY_IN_CALIBRATION 3 +#define IMX93_ADC_MSR_ADCSTATUS_SAMPLE 4 +#define IMX93_ADC_MSR_ADCSTATUS_CONVERSION 6 + +#define IMX93_ADC_TIMEOUT msecs_to_jiffies(100) + +struct imx93_adc { + struct device *dev; + void __iomem *regs; + struct clk *ipg_clk; + int irq; + struct regulator *vref; + /* lock to protect against multiple access to the device */ + struct mutex lock; + struct completion completion; +}; + +#define IMX93_ADC_CHAN(_idx) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .channel = (_idx), \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \ + BIT(IIO_CHAN_INFO_SAMP_FREQ), \ +} + +static const struct iio_chan_spec imx93_adc_iio_channels[] = { + IMX93_ADC_CHAN(0), + IMX93_ADC_CHAN(1), + IMX93_ADC_CHAN(2), + IMX93_ADC_CHAN(3), +}; + +static void imx93_adc_power_down(struct imx93_adc *adc) +{ + u32 mcr, msr; + int ret; + + mcr = readl(adc->regs + IMX93_ADC_MCR); + mcr |= FIELD_PREP(IMX93_ADC_MCR_PWDN_MASK, 1); + writel(mcr, adc->regs + IMX93_ADC_MCR); + + ret = readl_poll_timeout(adc->regs + IMX93_ADC_MSR, msr, + ((msr & IMX93_ADC_MSR_ADCSTATUS_MASK) == + IMX93_ADC_MSR_ADCSTATUS_POWER_DOWN), + 1, 50); + if (ret == -ETIMEDOUT) + dev_warn(adc->dev, + "ADC do not in power down mode, current MSR is %x\n", + msr); +} + +static void imx93_adc_power_up(struct imx93_adc *adc) +{ + u32 mcr; + + /* bring ADC out of power down state, in idle state */ + mcr = readl(adc->regs + IMX93_ADC_MCR); + mcr &= ~FIELD_PREP(IMX93_ADC_MCR_PWDN_MASK, 1); + writel(mcr, adc->regs + IMX93_ADC_MCR); +} + +static void imx93_adc_config_ad_clk(struct imx93_adc *adc) +{ + u32 mcr; + + /* put adc in power down mode */ + imx93_adc_power_down(adc); + + /* config the AD_CLK equal to bus clock */ + mcr = readl(adc->regs + IMX93_ADC_MCR); + mcr |= FIELD_PREP(IMX93_ADC_MCR_ADCLKSE_MASK, 1); + writel(mcr, adc->regs + IMX93_ADC_MCR); + + imx93_adc_power_up(adc); +} + +static int imx93_adc_calibration(struct imx93_adc *adc) +{ + u32 mcr, msr; + int ret; + + /* make sure ADC in power down mode */ + imx93_adc_power_down(adc); + + /* config SAR controller operating clock */ + mcr = readl(adc->regs + IMX93_ADC_MCR); + mcr &= ~FIELD_PREP(IMX93_ADC_MCR_ADCLKSE_MASK, 1); + writel(mcr, adc->regs + IMX93_ADC_MCR); + + imx93_adc_power_up(adc); + + /* + * TODO: we use the default TSAMP/NRSMPL/AVGEN in MCR, + * can add the setting of these bit if need in future. + */ + + /* run calibration */ + mcr = readl(adc->regs + IMX93_ADC_MCR); + mcr |= FIELD_PREP(IMX93_ADC_MCR_CALSTART_MASK, 1); + writel(mcr, adc->regs + IMX93_ADC_MCR); + + /* wait calibration to be finished */ + ret = readl_poll_timeout(adc->regs + IMX93_ADC_MSR, msr, + !(msr & IMX93_ADC_MSR_CALBUSY_MASK), 1000, 2000000); + if (ret == -ETIMEDOUT) { + dev_warn(adc->dev, "ADC do not finish calibration in 2 min!\n"); + imx93_adc_power_down(adc); + return ret; + } + + /* check whether calbration is success or not */ + msr = readl(adc->regs + IMX93_ADC_MSR); + if (msr & IMX93_ADC_MSR_CALFAIL_MASK) { + dev_warn(adc->dev, "ADC calibration failed!\n"); + imx93_adc_power_down(adc); + return -EAGAIN; + } + + return 0; +} + +static int imx93_adc_read_channel_conversion(struct imx93_adc *adc, + int channel_number, + int *result) +{ + u32 channel; + u32 imr, mcr, pcda; + long ret; + + reinit_completion(&adc->completion); + + /* config channel mask register */ + channel = 1 << channel_number; + writel(channel, adc->regs + IMX93_ADC_NCMR0); + + /* TODO: can config desired sample time in CTRn if need */ + + /* config interrupt mask */ + imr = FIELD_PREP(IMX93_ADC_IMR_EOC_MASK, 1); + writel(imr, adc->regs + IMX93_ADC_IMR); + writel(channel, adc->regs + IMX93_ADC_CIMR0); + + /* config one-shot mode */ + mcr = readl(adc->regs + IMX93_ADC_MCR); + mcr &= ~FIELD_PREP(IMX93_ADC_MCR_MODE_MASK, 1); + writel(mcr, adc->regs + IMX93_ADC_MCR); + + /* start normal conversion */ + mcr = readl(adc->regs + IMX93_ADC_MCR); + mcr |= FIELD_PREP(IMX93_ADC_MCR_NSTART_MASK, 1); + writel(mcr, adc->regs + IMX93_ADC_MCR); + + ret = wait_for_completion_interruptible_timeout(&adc->completion, + IMX93_ADC_TIMEOUT); + if (ret == 0) + return -ETIMEDOUT; + + if (ret < 0) + return ret; + + pcda = readl(adc->regs + IMX93_ADC_PCDR0 + channel_number * 4); + + *result = FIELD_GET(IMX93_ADC_PCDR_CDATA_MASK, pcda); + + return ret; +} + +static int imx93_adc_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + struct imx93_adc *adc = iio_priv(indio_dev); + struct device *dev = adc->dev; + long ret; + u32 vref_uv; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + pm_runtime_get_sync(dev); + mutex_lock(&adc->lock); + ret = imx93_adc_read_channel_conversion(adc, chan->channel, val); + mutex_unlock(&adc->lock); + pm_runtime_mark_last_busy(dev); + pm_runtime_put_sync_autosuspend(dev); + if (ret < 0) + return ret; + + return IIO_VAL_INT; + + case IIO_CHAN_INFO_SCALE: + ret = vref_uv = regulator_get_voltage(adc->vref); + if (ret < 0) + return ret; + *val = vref_uv / 1000; + *val2 = 12; + return IIO_VAL_FRACTIONAL_LOG2; + + case IIO_CHAN_INFO_SAMP_FREQ: + *val = clk_get_rate(adc->ipg_clk); + return IIO_VAL_INT; + + default: + return -EINVAL; + } +} + +static irqreturn_t imx93_adc_isr(int irq, void *dev_id) +{ + struct imx93_adc *adc = dev_id; + u32 isr, eoc, unexpected; + + isr = readl(adc->regs + IMX93_ADC_ISR); + + if (FIELD_GET(IMX93_ADC_ISR_EOC_ECH_MASK, isr)) { + eoc = isr & IMX93_ADC_ISR_EOC_ECH_MASK; + writel(eoc, adc->regs + IMX93_ADC_ISR); + complete(&adc->completion); + } + + unexpected = isr & ~IMX93_ADC_ISR_EOC_ECH_MASK; + if (unexpected) { + writel(unexpected, adc->regs + IMX93_ADC_ISR); + dev_err(adc->dev, "Unexpected interrupt 0x%08x.\n", unexpected); + return IRQ_NONE; + } + + return IRQ_HANDLED; +} + +static const struct iio_info imx93_adc_iio_info = { + .read_raw = &imx93_adc_read_raw, +}; + +static int imx93_adc_probe(struct platform_device *pdev) +{ + struct imx93_adc *adc; + struct iio_dev *indio_dev; + struct device *dev = &pdev->dev; + int ret; + + indio_dev = devm_iio_device_alloc(dev, sizeof(*adc)); + if (!indio_dev) + return dev_err_probe(dev, -ENOMEM, + "Failed allocating iio device\n"); + + adc = iio_priv(indio_dev); + adc->dev = dev; + + mutex_init(&adc->lock); + adc->regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(adc->regs)) + return dev_err_probe(dev, PTR_ERR(adc->regs), + "Failed geting ioremap resource\n"); + + /* The third irq is for ADC conversion usage */ + adc->irq = platform_get_irq(pdev, 2); + if (adc->irq < 0) + return adc->irq; + + adc->ipg_clk = devm_clk_get(dev, "ipg"); + if (IS_ERR(adc->ipg_clk)) + return dev_err_probe(dev, PTR_ERR(adc->ipg_clk), + "Failed getting clock.\n"); + + adc->vref = devm_regulator_get(dev, "vref"); + if (IS_ERR(adc->vref)) + return dev_err_probe(dev, PTR_ERR(adc->vref), + "Failed getting reference voltage.\n"); + + ret = regulator_enable(adc->vref); + if (ret) + return dev_err_probe(dev, ret, + "Failed to enable reference voltage.\n"); + + platform_set_drvdata(pdev, indio_dev); + + init_completion(&adc->completion); + + indio_dev->name = "imx93-adc"; + indio_dev->info = &imx93_adc_iio_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = imx93_adc_iio_channels; + indio_dev->num_channels = ARRAY_SIZE(imx93_adc_iio_channels); + + ret = clk_prepare_enable(adc->ipg_clk); + if (ret) { + dev_err_probe(dev, ret, + "Failed to enable ipg clock.\n"); + goto error_regulator_disable; + } + + ret = request_irq(adc->irq, imx93_adc_isr, 0, IMX93_ADC_DRIVER_NAME, adc); + if (ret < 0) { + dev_err_probe(dev, ret, + "Failed requesting irq, irq = %d\n", adc->irq); + goto error_ipg_clk_disable; + } + + ret = imx93_adc_calibration(adc); + if (ret < 0) + goto error_free_adc_irq; + + imx93_adc_config_ad_clk(adc); + + ret = iio_device_register(indio_dev); + if (ret) { + dev_err_probe(dev, ret, + "Failed to register this iio device.\n"); + goto error_adc_power_down; + } + + pm_runtime_set_active(dev); + pm_runtime_set_autosuspend_delay(dev, 50); + pm_runtime_use_autosuspend(dev); + pm_runtime_enable(dev); + + return 0; + +error_adc_power_down: + imx93_adc_power_down(adc); +error_free_adc_irq: + free_irq(adc->irq, adc); +error_ipg_clk_disable: + clk_disable_unprepare(adc->ipg_clk); +error_regulator_disable: + regulator_disable(adc->vref); + + return ret; +} + +static int imx93_adc_remove(struct platform_device *pdev) +{ + struct iio_dev *indio_dev = platform_get_drvdata(pdev); + struct imx93_adc *adc = iio_priv(indio_dev); + struct device *dev = adc->dev; + + /* adc power down need clock on */ + pm_runtime_get_sync(dev); + + pm_runtime_disable(dev); + pm_runtime_dont_use_autosuspend(dev); + pm_runtime_put_noidle(dev); + + iio_device_unregister(indio_dev); + imx93_adc_power_down(adc); + free_irq(adc->irq, adc); + clk_disable_unprepare(adc->ipg_clk); + regulator_disable(adc->vref); + + return 0; +} + +static int imx93_adc_runtime_suspend(struct device *dev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct imx93_adc *adc = iio_priv(indio_dev); + + imx93_adc_power_down(adc); + clk_disable_unprepare(adc->ipg_clk); + regulator_disable(adc->vref); + + return 0; +} + +static int imx93_adc_runtime_resume(struct device *dev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct imx93_adc *adc = iio_priv(indio_dev); + int ret; + + ret = regulator_enable(adc->vref); + if (ret) { + dev_err(dev, + "Can't enable adc reference top voltage, err = %d\n", + ret); + return ret; + } + + ret = clk_prepare_enable(adc->ipg_clk); + if (ret) { + dev_err(dev, "Could not prepare or enable clock.\n"); + goto err_disable_reg; + } + + imx93_adc_power_up(adc); + + return 0; + +err_disable_reg: + regulator_disable(adc->vref); + + return ret; +} + +static DEFINE_RUNTIME_DEV_PM_OPS(imx93_adc_pm_ops, + imx93_adc_runtime_suspend, + imx93_adc_runtime_resume, NULL); + +static const struct of_device_id imx93_adc_match[] = { + { .compatible = "nxp,imx93-adc", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, imx93_adc_match); + +static struct platform_driver imx93_adc_driver = { + .probe = imx93_adc_probe, + .remove = imx93_adc_remove, + .driver = { + .name = IMX93_ADC_DRIVER_NAME, + .of_match_table = imx93_adc_match, + .pm = pm_ptr(&imx93_adc_pm_ops), + }, +}; + +module_platform_driver(imx93_adc_driver); + +MODULE_DESCRIPTION("NXP i.MX93 ADC driver"); +MODULE_AUTHOR("Haibo Chen "); +MODULE_LICENSE("GPL"); From patchwork Tue Jan 17 13:51:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 13104703 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 E39ECC63797 for ; Tue, 17 Jan 2023 13:54: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=xAkwldEd9TFNxA7ZKrl6QWHdef11f3ZB6ElZmiujL5k=; b=mI+01LewK/pTXc RQKeUiigueH8XGnm+BQ5hG3AYSmG19wKx1cIP5VLEHZG60F7iF89BpGeQiD9erpUXSZIJUtnVvZ+O sWD7Kj29ZgwH4YoM52s2ruvR0mU2eTwWtD8ccvN6jwG8bvVWv73ui9XMzR4wJzke7T+5tdIqD7lSP Z6Ga3GOroUA0viovwFURvHuG88wvWxvRK9FpGVzYtbLT5WnTCsT1tw3IGcJaSWuJ+lx/alNea5bvO C4dKjC9wv8f0qWST3X3gXz7ONI2J/VxZtTaIsWY0sJJUrQI0uJjOZj9mVsPTJPpz6iZYZh+Lyeu9C akARIicxZKGx+cl+EuuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHmOR-00ETlj-5V; Tue, 17 Jan 2023 13:52:51 +0000 Received: from mail-db3eur04on2047.outbound.protection.outlook.com ([40.107.6.47] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHmN5-00ETIb-DM for linux-arm-kernel@lists.infradead.org; Tue, 17 Jan 2023 13:51:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HHyNDdIRLPrBVZVqDA3iKT8EoFzo7Xm0m8abhQpnukILeFbq2L1trikcdzdzQ35n26YkxsbxxWKuZ6osnshPt5X1oeMylGCGp317mEePNZ6y/0Nwz8uDaBvLrUXY8ByyJoeu5OnZtkDUEeQKkyYWXw/GPJ8gIt/eygw9lxgwi9P360jD9aL71KB0D4JsZd1sqcJoHPlocpO9C2OSd1Z0wO+uFt1z2xSB3ut/FQ0HHno9cNm2YCljFs2zXMssQqZUWExLBzfsNpqUCaiYKpvO009nKu4Bv7U9IZlw2X9Al5vS3QsJZYnaaLnIxHkFm0RAVBJ4EZTakxNvxYezq7QX4w== 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=0Dckup4bNqyej2ibkcfsxjXeol4324ikjI78C+Rf6Q4=; b=IfKcMnHi2zf/eCzRbQ2jp45STQ7Prj5iuN5KWnW0IZrvQ7oepcVuT2gVQlsYwJwaDwaVt3C4Oi2kSQe8P3ZPsk9H2592uPUa4UdecKOA0R9zA6UN52GBvlOLWb3RmcgvnX+2//dUy+U/NRGToR5O0QD/fF1UzkFzELQoa6Mg6KUbfVAYKLz3tgVzFNGRgaqqBxsB1xO290HTYaJo1dKBfBBiVFd7nQKgpGxfF21VHM1y4BEZ/7C4nrQdNVlr3wk0FA27cIt/26FfPlTmsxkkj7P5wupbWgOaIpMr4vCdEUf+8kDvORi/j/vOA+ZhgmRhKGR4sS2MHXHSp28F/NiUhA== 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=0Dckup4bNqyej2ibkcfsxjXeol4324ikjI78C+Rf6Q4=; b=G6+d45zxE6wz/QRJLZjF37qO9WNqoOQ8RBKMU1cLoTa/9AQp+B16qYjJUXTi38KzpbZTiZoulwb7g2NE671IDRIh192Ax+5luoEDTAsG3Jq9reUc48LxKUMhffqyl7V8p1MgKrDcMGusNaCfCIgjkF00C96COnqSiAgD33seOEc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4010.eurprd04.prod.outlook.com (2603:10a6:5:21::30) by VI1PR04MB6909.eurprd04.prod.outlook.com (2603:10a6:803:13d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Tue, 17 Jan 2023 13:51:22 +0000 Received: from DB7PR04MB4010.eurprd04.prod.outlook.com ([fe80::7479:76ef:8e5:da0b]) by DB7PR04MB4010.eurprd04.prod.outlook.com ([fe80::7479:76ef:8e5:da0b%6]) with mapi id 15.20.6002.012; Tue, 17 Jan 2023 13:51:22 +0000 From: haibo.chen@nxp.com To: jic23@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: lars@metafoo.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, haibo.chen@nxp.com Subject: [PATCH v6 2/3] dt-bindings: iio: adc: Add NXP IMX93 ADC Date: Tue, 17 Jan 2023 21:51:36 +0800 Message-Id: <20230117135137.1735536-3-haibo.chen@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230117135137.1735536-1-haibo.chen@nxp.com> References: <20230117135137.1735536-1-haibo.chen@nxp.com> X-ClientProxiedBy: SI2P153CA0016.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::17) To DB7PR04MB4010.eurprd04.prod.outlook.com (2603:10a6:5:21::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4010:EE_|VI1PR04MB6909:EE_ X-MS-Office365-Filtering-Correlation-Id: c4bebf70-b3de-4e01-053b-08daf891eab9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SGfUHrn0dUlzkhz+yHb9EL+7xYrA75PwMOz1eCDBRfQtDbxj0ntqtSiBv3WlbSbLeF83soLWaNufFLsT+cUKOIuzVoCu2IJXPkxKJYhJkyjRJD/F4nob6I+xxoe92u/JDWZ5zlY605U+4PU6CgfVdNJ2ND/e5MgW23tvfcio2jvcRe5t1rKRiKWYNmhKt2tOh3GXdPUSGx2/3o+ArsK8pSeN+Ek7JNuBADfN9kcpUZz0UKWuRwoO4tB7IhqpL4XWXnAhwc0A61XFO/P4KzEiyVcQq4VHmkx4pvJcCZxcgHqg8sgNsTlvdQYbudVQ22O1LLeWLC+AM+rM0zgTIgUYp883pLRK+x3Domu5rFn/Yfl+v4IfiVlpRGAM5oIgLsp3A/R9/Kfpz2BHVGT9P3A1e2ad4ZhYrXFEz3tRK6bGq+3E6tgNxGsYGVaEHLecz2zj5tXJYrtflIErfswH0V9BOLVMBboFlEzgSLFfXA4Ap9nhsfeHjE4uA2m4mi80YRJj24awamq7/k4IdktJeZebvaXmymVfc7K+wAaBfgB9amSbs8gHJYI3jJPMdoL+fXFjqQ2LrULZyjzgkH+A+W7qGo6RldF7QvlHp+c0A3gQsbwXqWd30ASn7VKONEwbfv6tG7nuVmAjX4cPLDB9HPjcFPZNNanmul7b1/8/cmGgjLmiMkh8H54rGhp9NWCDPZRN+OhZRqQGvyyzEoJKdfVcmHSb5PKCuGcbc+7LfB0w09177gT52km0KMPdFgZ8EGp2 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB4010.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(366004)(136003)(39860400002)(346002)(376002)(451199015)(36756003)(86362001)(66946007)(66556008)(8936002)(8676002)(66476007)(7416002)(2906002)(4326008)(38100700002)(83380400001)(5660300002)(38350700002)(316002)(6666004)(6486002)(52116002)(966005)(41300700001)(478600001)(2616005)(6512007)(1076003)(9686003)(26005)(186003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vHPUuYkuQE/D8zakpbhX8Mb3Tcbp/qKRN6QE32EhB9y46aIMPp57uN6zl/4SREKrEdlY8fA47Zyzqwnb8owwjhPDMihZqn0df4RtNbEBpxrzTvSHZSqaMfEGZzaELPnhr/e4DhJ1FjSJAW2fX8VY98H20N7Y/ZHbe/xcQd5fS6Rd/N6qZfx28h+4/5iwWv8eRTeMp7v/XKSiaaWaEUgOWLnm94ZQDdgiw9ng8zyLiTS3EdRfBFz5UYw+DhgVHm3D6lIJg25c0rSmQ2RfrxCxz0cSQzGX0PNbLEaBpEpLsUtziBWTMhi3Y/ktjFhA/WnnbqeL2n6PmRaelc12iNKrk20tucJZziOhin/zkjXKBFMkfYu8oluM/OIhFj1KjrfOlDMROX/rdPjE73Q/LwjhDSmAmaUg6lss7g8Q5U9JkwpyfWN8EyanQ6k3FySpt8+89w1oUfUzQi9jxfq4HUTwx3oLbhdocjRKahyA7aYF0aJ0xXzrOHijeVnB1nhl0lABTIAHtpsnHZsEvRaof7uJ5hX/sRABdnEuEH7/nwn3HyOKvKAF8O4XMcAzPd71yLS5RSlO5ykiFJRIN7+Zc519fu+J+Ze0FlOazKVYD0QP0ngIQ5rxYSsZwVSZqlYAuz9N3FIe720SCE5gaETp0+bphdwR37BUROrT9GeMckezxY3inBzhA1kAcEhejnOBdsGsCrtSdJv/i9Vu6AYTSmcSxHuje5YhSsrMNVpzm+AvXIrtN0FQ0rExILJf5DRckII8zwBVA52MoQZiofqEjyz+xzlSDgitS09XxIBMHtY+QUy0V9jF8nU8cHU9e7DQ2wTojJUW0urgnemI8QXF5iOggi5sRIzr0BPLEJNm4cWUiHgRnzK9/Z5R2kwg0T6V+NrFQLY5PEhzSQuAUWA9rLhcJa5/CpTxOm6m/eMgMcafQugIPWB/qU+QIxL3rCG/ywrHclRTy9FmdN22qUThwgeMkOqF2k/TwuOvTttVFTV7fL1aTq1vKRGgSYtjIgiDQFYywyB370ctF8s0ropVsif3cGuunVYd1GlCJqHS4cjXN7VMdCMntiqxfmGeuPcHTCdc/gD9JnCYK7u1Id3TyxRbGMNXJUIAloJqTPGytf2tVVXe6dzXwANPYKO0o/HJ/x7qu/2Xmh6LPX8hD7Jxjqcb6xjPSNa7yTZbH1tX3bXyQXHpDR+nmvAFHZxTfJqgpprRxZomeL0PSVHtNTjLyymSnY1gKM8+mFSHldKXwcc7CGMgQWn+5gf70Ao54qz6/uxn6UZ/XMa3PPRbjozXePkZ08b3lzEpH/y4g1OEGEuCi48YoHqR15QaHtpgj/3suQvdWeiUHDetDC2NTDVdFx7XKwmJkMi1+kwbRTcqvzo3uu7uCN24b1LwyQuqGK3BbKzWtfew5MifMK399INYEnwJHsbQ1DeMhWO2Q1PMbRJzbP3JTyIYZD0F/kqFbYlzqJOywTmqORNxrRh+g8VIs4Uc5xh1W4fyzblE2tNedqSWmwn4/Hvaf6Eg1S5QMUnW8vuChO5/k2kXtMAXIdRBQmISfnAR4zTGX0EJbHgjXIYGRfytMkWho8HJe4N2/+SdkKNx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4bebf70-b3de-4e01-053b-08daf891eab9 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4010.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 13:51:21.9849 (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: UcUWqHrw4Wi65kwQ98KCEoopPhHLG1QUgDFigRix3U0uuxVHKk8EJIjPzKbTrkWqk0pKCzj/PNgM8CgX4i7glw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230117_055127_515842_E49B2E48 X-CRM114-Status: GOOD ( 13.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Haibo Chen The IMX93 SoC has a new ADC IP, so add binding documentation for NXP IMX93 ADC. Reviewed-by: Rob Herring Signed-off-by: Haibo Chen --- .../bindings/iio/adc/nxp,imx93-adc.yaml | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml diff --git a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml new file mode 100644 index 000000000000..dacc526dc695 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml @@ -0,0 +1,81 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/nxp,imx93-adc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP iMX93 ADC + +maintainers: + - Haibo Chen + +description: + The ADC on iMX93 is a 8-channel 12-bit 1MS/s ADC with 4 channels + connected to pins. it support normal and inject mode, include + One-Shot and Scan (continuous) conversions. Programmable DMA + enables for each channel Also this ADC contain alternate analog + watchdog thresholds, select threshold through input ports. And + also has Self-test logic and Software-initiated calibration. + +properties: + compatible: + const: nxp,imx93-adc + + reg: + maxItems: 1 + + interrupts: + items: + - description: WDGnL, watchdog threshold interrupt requests. + - description: WDGnH, watchdog threshold interrupt requests. + - description: normal conversion, include EOC (End of Conversion), + ECH (End of Chain), JEOC (End of Injected Conversion) and + JECH (End of injected Chain). + - description: Self-testing Interrupts. + + clocks: + maxItems: 1 + + clock-names: + const: ipg + + vref-supply: + description: + The reference voltage which used to establish channel scaling. + + "#io-channel-cells": + const: 1 + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - vref-supply + - "#io-channel-cells" + +additionalProperties: false + +examples: + - | + #include + #include + #include + soc { + #address-cells = <1>; + #size-cells = <1>; + adc@44530000 { + compatible = "nxp,imx93-adc"; + reg = <0x44530000 0x10000>; + interrupts = , + , + , + ; + clocks = <&clk IMX93_CLK_ADC1_GATE>; + clock-names = "ipg"; + vref-supply = <®_vref_1v8>; + #io-channel-cells = <1>; + }; + }; +... From patchwork Tue Jan 17 13:51:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 13104704 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 118FFC63797 for ; Tue, 17 Jan 2023 13:55:30 +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=HTsFwagjhjYfhs8B7aH6ebZPnH56f9SMd0hwXkSJwxA=; b=KiMJm7V7KV21HB YNBrMAnXQTGyTU0xf+wg9zBS7Zco5HTA8X/ZXmh60iBMvgxKDUKuWNHiO7S10zXwITkCnv31m6Cxk aRAymeEIXKgtGW5cWuBBUK4rX6F8a2zIPpYduM2UskOnmhUdkzQJ8OihL9IEYggUP2qldbUV9p14T wLg2m2H1YEuu6tlPx+A1fFh/QwvzM6jW66VENsMpslz555sI+y1wiPyYOI2EMEhgl/TcsbQI7e+uE 98uZ+XeqgUkfgb4Rseact+Jfqet4g31jOlngOY2WwWA7+SV0B6CGmne5AVKDO91XqRm6YKSRUaXG2 gHNXCdkLSkdVXUhqKVtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHmPn-00EUDR-4E; Tue, 17 Jan 2023 13:54:15 +0000 Received: from mail-db3eur04on2047.outbound.protection.outlook.com ([40.107.6.47] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHmN7-00ETIb-NY for linux-arm-kernel@lists.infradead.org; Tue, 17 Jan 2023 13:51:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fj5pykZYD+0kIOOeKyjJ4rvjEhC3esXJ8puMpxTbHtcGMWhfX9/vLzYCLglh0QfIU2bCYdY5McPiNiViVV1nYMvHrkSmnmnGTGAfiYzuxG4IShwBXvwB6dEzHd6IzNXS9wj1awNboFMe4ca/8rDHnQMgRZB44AAfY9HY8qZz1Dbu7Pz1EQZ9Ifa+QR4BtJTs85RXPfF0P2NNdx1Bi0SbS+/WE9L3O/x4Ze4D+GBY4kTpnOKU4v8CuRPvFTqMYMEbZEUjUn4fa99LIeJ+1b6X078ZklWj3Magjw/Xpce75lKEhg/Umq+G6dfGo4GwP2C3YaJ6QbbYoRIF3jpVPGp+yQ== 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=i9VMheMwhKy88WKtB/x0JuUemVSQFfTfqkFMuOlyidw=; b=fJxT1SRaCknqB+nORKja0B88miCZyMtpj9iAaC4DrmFplBymGqYasOxSEQKHhZh8fTXrLq1mgi71DGwkw/yh2bfkMQOkdZH2aGmcDm5klWH0DfmzAFSClsnop/7kQ9swgxOkxMoGf1Uh1H96B7jRzLgJ+U+3Yu75Hr3tuw79djcLtswlWwnvMEXEgBxIVNfRgxnCPADLbF9+RzbBYngy3RhyiHaVQDmXbVxHqxEkqxwUKUljaQ74z58RD6LmdmksrdOiQ0925Fx8aNtbo4fyja0sut1D6Q041ifFtGm9jJfMOKdSRUHEBIRJimoaDs6o98lhZvosBWBjNWHx6uMSgA== 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=i9VMheMwhKy88WKtB/x0JuUemVSQFfTfqkFMuOlyidw=; b=BH3IHMfMSBfP22BACx/PdNOAYfe7FAIgN3wyITcy1v73qUMHQsPfTSbqk0m/BWZU8mdB4ZFzcuTAkFREPhofGL7cQg7AMVAqyv074+eC7jmOGdyEw/dFuYCSnGrEdFtcvBPk3190ZD6gNJl0VKDaYdt/iy8tZlTgzzKvJ16uRgA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4010.eurprd04.prod.outlook.com (2603:10a6:5:21::30) by VI1PR04MB6909.eurprd04.prod.outlook.com (2603:10a6:803:13d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Tue, 17 Jan 2023 13:51:26 +0000 Received: from DB7PR04MB4010.eurprd04.prod.outlook.com ([fe80::7479:76ef:8e5:da0b]) by DB7PR04MB4010.eurprd04.prod.outlook.com ([fe80::7479:76ef:8e5:da0b%6]) with mapi id 15.20.6002.012; Tue, 17 Jan 2023 13:51:26 +0000 From: haibo.chen@nxp.com To: jic23@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: lars@metafoo.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, haibo.chen@nxp.com Subject: [PATCH v6 3/3] arm64: dts: imx93: add ADC support Date: Tue, 17 Jan 2023 21:51:37 +0800 Message-Id: <20230117135137.1735536-4-haibo.chen@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230117135137.1735536-1-haibo.chen@nxp.com> References: <20230117135137.1735536-1-haibo.chen@nxp.com> X-ClientProxiedBy: SI2P153CA0016.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::17) To DB7PR04MB4010.eurprd04.prod.outlook.com (2603:10a6:5:21::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4010:EE_|VI1PR04MB6909:EE_ X-MS-Office365-Filtering-Correlation-Id: a4d51a46-cb17-4a5b-f0a8-08daf891ed18 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ch9TJmmvReRiYSKt6wSTRBuO4THVNIt1ykSpIgQBad/88xfWyLcvsyyLuloNaZGs4Z44qvtoCOJb+KFgyuw1vE+BIEiHtYlMhySlbCtNIdehUKcLiEQVRIOwBWN+NrWPEOZzmlEvrgESFxLX+f5OvSahu1TqFbX1VuQAt5UEBB5zcw6H+HHQGZ7W8Tbx+YLl7xvoNWLFqpauNft3R5QwcZwvq8wBtZHkGyNWWRsVkAhpW1yo6tScbS/qit/Wx7sS3fFWu2WpfJ02QA1SjSVxqwFiA0BfKfETQNazyVwajOU/VTFBNUOXWo8jm8NMxenZBnenRWR4U0eBXcjNeSq0UyIDC0BvNw97ouMNwxdm0hNzwmgqXW4QTsXeYpBxmbH095SEHb9imk/k4ZjaKE5edZn8m1Dn8Gjb776qP+iXUGoh+WfZbp44VRK6dAVssEl5RXLNj0F/RiIhjwKveVbLlgtEMLOA9laS5ft0QFKlkuYVSgDl3UUhh1eIihX0jYxcpMAvrNZz/TQ/aKai8nQc7rRpG8mIaHSWTymbMaDUeFkHCv2dyfoamo9qHboNNXvSNoX+y1TuysdV5IWKxn5EWa0bAFUcqCHD0Ud66sA8BcrnUJf6hTkcPrnXYFl84fPVH6x+N4r92cgWH3/d7CZQWIZz0M3SXOrr2A+hKaYqj5R5k2exAdUqGuhGfX3PmQF29LUlVfLIXAEcjTJEajj/Kw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB4010.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(366004)(136003)(39860400002)(346002)(376002)(451199015)(36756003)(86362001)(66946007)(66556008)(8936002)(8676002)(66476007)(7416002)(2906002)(4326008)(38100700002)(83380400001)(5660300002)(38350700002)(316002)(6666004)(6486002)(52116002)(41300700001)(478600001)(2616005)(6512007)(1076003)(9686003)(26005)(186003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7LyFfEEKkUA2hlkkwFPtXNg3/G5Y9hztMnnkSfktsX16sbJP+jQJBO7Z8urPkGZ2MyfenWc7oV/JpZbFrJS7oXTzpg79c1qS0YyU27JfFysVR/McN8+icANJxNEPTlMZut3SZ+Kodq2tT0W+TJWqFov8kl8APUniRtZgCuS2CLWPTgZ+Sbf0960qBiEPDjFovnpxptMLR1L7KbFSEbwi+ITmSa5IJr5IXPHgUAR+A6GBmVaJ4Ss3zDmvjZVCM6kbETYRAn2tMI2mTlVEAOyIgzPtOF4ndl5zl1/ndvZswBah9NYdOpsrKqY7bMeie/mFOmbzxO6Ztw8axdweqjcSzm8QrQB8d5i35qOOhJAWtlvBONnWjPubx++zHFsI+HoFmCiUDRWixkUgljxqlzu0iLRcgGOn/glSXfZLbU02UxTskgKOaC1QfyKH+v7LZSlGpLBAKdt+CrcXNmd/0WfVwGZO9KBSyvZYGqfOx36dTDjMGS9/CLhHS37creVIGYZWbNtdcPhOjLsceUSfuG6l+0iRzeWdSYjFJ01OqRRK+DnSh1lBxq/EhQa7M16dSSPLeF1044chM9Xp5X3ULJLkO+e/4XPAg+ZWs+F6i98ptDdAOqI+q0BAYGm7Qls9hraz+lJgeJsuoNj/O+6TbR+28j+dVj1HZZyOxLVl0qy1W8LH0BnvjOYlFBcYuzEhU6miX1yn4BvMtiDh+HlFPEzewj1vK+H2xwJrkMArDYSeEvKNje4w4xbFysynAXYfuNOVPAhBUOykQsfyxELIxCNxYI18Lgn1rJVoFyzpFwE2ikab4u+GYHax4z7J7udA6Cf7fMFj1JjcmPg5+YJWLLTmj89QFn6+FDiuOY2T5CcJPqloj8DXtje3Bwq/1onB+P4M9fd8Y+AYJjBvuXWFKABFHz33sArfLLFNMl2mLAbofMiuzxFPQq/60jeJQiNFm0snZmeXDx8Fo+p2L32D4CAFk2c5P4UlDwZKbvAyLtwgaLZNijpUoQjbDN0neMAB6dt4IARIJbWUBzES3+ubPdLA/M0FbNKhTtKd2Nb8SbDOW7EQWWZFeKGRHcJgfrIhu7eYPbqWRkW9ok7kDOiYGbL+smyYIwAsfbAa2RobVZ9B6F3UxVLXpwMHDagkFJiTJ4QKfqL9lflrvpJB2jQWrowlb0ukTuUFIS9WvDNs1rQ8PRPzoCsRuf5sSGGMjbR3zG1u+9uzOn6rp7zcYvPjF8up6UdHiFJzKyloVtPBrjy2VWZjZT1XmzF8h+LzgpzGK4COwNC5ccev/GWWzhTSayuyrgzVBpqbD8RLtGJ55RsJVo0TGBUqFARI6juBVHozXWGq/EkjMFdISA58DJaWnfMcn5q4KR7y5Rrf8jKGprtWP20+R6wd/0qUHElieiXUcuNnqhkbb625+TZi3SJvjOTt1a+v2V50mDmJz0Y539nmHv+SHM3QeIyaPADfsoVEiLBokXyKKmhIlXAFjX0PgAP7RbVtgyxv+bb2jqKr9qnspsImlfZ1Ag39ZZTH+zOcu6OqqH8wWbgz8/ust7CSr1f7iV2sKk33BdYjOwRKMDqBzvBd8t8GHtjW7zL42LB70tyi X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4d51a46-cb17-4a5b-f0a8-08daf891ed18 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4010.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 13:51:26.0627 (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: s8a6DfiIqscXwTXNT9Z+Rr+upZA9xxqO7EtoE3RdMkQjFLgBL5UUwB6AX9NB3oaK+AtNnTwlR8582AUmrIziFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230117_055129_823456_C38DA3C7 X-CRM114-Status: GOOD ( 10.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Haibo Chen Add ADC support for imx93-11x11-evk board. Signed-off-by: Haibo Chen --- arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts | 12 ++++++++++++ arch/arm64/boot/dts/freescale/imx93.dtsi | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts b/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts index 27f9a9f33134..c928b6824e41 100644 --- a/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts +++ b/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts @@ -15,6 +15,13 @@ chosen { stdout-path = &lpuart1; }; + reg_vref_1v8: regulator-adc-vref { + compatible = "regulator-fixed"; + regulator-name = "vref_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + reg_usdhc2_vmmc: regulator-usdhc2 { compatible = "regulator-fixed"; pinctrl-names = "default"; @@ -27,6 +34,11 @@ reg_usdhc2_vmmc: regulator-usdhc2 { }; }; +&adc1 { + vref-supply = <®_vref_1v8>; + status = "okay"; +}; + &mu1 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi index 6808321ed809..abb3fbe4ba22 100644 --- a/arch/arm64/boot/dts/freescale/imx93.dtsi +++ b/arch/arm64/boot/dts/freescale/imx93.dtsi @@ -280,6 +280,19 @@ anatop: anatop@44480000 { compatible = "fsl,imx93-anatop", "syscon"; reg = <0x44480000 0x10000>; }; + + adc1: adc@44530000 { + compatible = "nxp,imx93-adc"; + reg = <0x44530000 0x10000>; + interrupts = , + , + , + ; + clocks = <&clk IMX93_CLK_ADC1_GATE>; + clock-names = "ipg"; + #io-channel-cells = <1>; + status = "disabled"; + }; }; aips2: bus@42000000 {