Message ID | 20230725083117.2745327-1-carlos.song@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2360733vqg; Tue, 25 Jul 2023 03:05:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlEiXZsISftvRJbqT0GlQBxGOa3qKNet2s0WEi9gf3X42FJdjdl93yswGhGMTXkT0BoRvUhP X-Received: by 2002:a17:907:2cc9:b0:99b:415f:2e4f with SMTP id hg9-20020a1709072cc900b0099b415f2e4fmr12536223ejc.57.1690279549093; Tue, 25 Jul 2023 03:05:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690279549; cv=pass; d=google.com; s=arc-20160816; b=g6djiMHNok2rf4BZH8MJzMDaQGg27P83JTb4wEgAs6IVaaSd7J//w5Mj4wVfQSWHoG XY2z4+kSMGLjEbqhdUP8ndUT67nrspYf1t9Rz1/tZ06Ej58NbtWPQJrCTuC1cHuFXt61 rgboO1SUrAZkHW0lDIIg69CP6Qgstj3guvSPf9fY0NqfJoyvlPdxKZmBVkX0humFKFfP 018A9+dH/j/lFGnnwCmEwLnmwSt8haF75mlk8ymnmioVNSldx/0lSyFYVYcBlM7i4FQe 5tBxg3nLdWKPrVzwQZVrc5s3Vu1oWnJlApH4/rxqh+oYBPj4/zGEDTj9+/U+S/mSdBaJ HcyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=MASy28P65nW4G7EzP2hrljzZyEeURzZY/LnNHvWd+dg=; fh=deKH+nUH4popjasJZTwvxVESPHmYORRP+rn6X2himLQ=; b=NV7XIu3ALC0xATla8Nhdv6xkc7bYIbpq02DlanzeiBJBYCixaqyweCVreL/FXNNfjp LGPaHtYx+IZst8x6ErP5pTAvo92LoaCmlX/Ix8Wq2huEj/kwvoPL0HsthriGZfUYRWJO B4cRLToVaefIy/GSyb+3rI8eacVVunxbzSw4XTiGNNcpslfuhK3+MpCnR4ki1cX7ijOg TUu9c/CZk7a3AbDuK4ES1JfATrvVEE1Ec7ePv1CBfazjc3Xv68sy3WgctQUFOmEEiZCj trKOEyYaMvG82oSFKqWe6dZUfjWMs1C7LwUlnPSY1dhsZ9efKNRugyz7AtnpJnIu9sBQ Q7fA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Bym56tEk; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lc5-20020a170906f90500b0099b41fa79f3si7833583ejb.331.2023.07.25.03.05.23; Tue, 25 Jul 2023 03:05:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Bym56tEk; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232445AbjGYI21 (ORCPT <rfc822;kloczko.tomasz@gmail.com> + 99 others); Tue, 25 Jul 2023 04:28:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232878AbjGYI14 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Jul 2023 04:27:56 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2084.outbound.protection.outlook.com [40.107.15.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87B8C19AA; Tue, 25 Jul 2023 01:27:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NalaYTYlQF+vlPr9pWia7Dracu3yWIhcx2eD9n3N2fMkDO5+O1vC2kbdnz/LOAVooq5Wm7G8co5xoo4Flp7B9M68fg4iJhQsALDU+G5h5EV9kYpaOpMvR5dwQIpwsG2hXVMU9qYq6/tjN2iFipbagi+5NPZWA8xU/PtDN6OdGhKnccOtbvDl26HsH9MnM3R//aVCPp23iUy6+H9zbSce+wC49IsWXF446szN2yqsF6AEXYfVNvmVQzP/qZgZ8Zy2ANu4cmBesTzePj0FKot4tBXc+653Hu9FwPcQb4Qg5xefl9flH1YggddzF7uoQfIk4AvWbYaQGdyR1t0ZWEYBJw== 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=MASy28P65nW4G7EzP2hrljzZyEeURzZY/LnNHvWd+dg=; b=kDy3JCslaJ5k29JJ01sPF7rNrxqiz6+rL+vrCMZ72dBAyVZ7wWfQI2Lg0G1cDt9MGnCLlnDYkMleuiC+MYJDfD9uEkI65p1EOmQZ6I/ZeKucYJ5daQC82FVrt1AYS5Xg738iuALLj2q3LJ/VScGE7CX739pdZp0xpNF2niRXQ6QNuaP0LqRGpEDqv650i66dKxbfouBFLdGUI9vCW4tLc5jOz2AfFe8/LDQ2yVerJQCSW/XDqvcgHOhWb1+1TxYx34ufqgeBqf2Y5fRDOlb987AdyJvhfUGgBUw910Ppo72iV9OIAOrHo0VpEJAqgll3n5RcsNjHsqDddVqC6brJjA== 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=MASy28P65nW4G7EzP2hrljzZyEeURzZY/LnNHvWd+dg=; b=Bym56tEk3oMj2PdNghhnrhnZ6dl2QDf07VX7dvInDUe5vSTkdv/oTYDaH98qgy2pG6LLpHPdXaw7sVaYHInXzotkCuPPngmnXuF1ED3RcpfdeXbom1iRtCYWmCzT0R5dTi/wZu0ZB2S3MrfmIqU/p+9xgEML65MZXkJZeqFlkbg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) by AS8PR04MB8562.eurprd04.prod.outlook.com (2603:10a6:20b:421::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33; Tue, 25 Jul 2023 08:27:33 +0000 Received: from VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::ea2b:9b70:e669:f0e4]) by VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::ea2b:9b70:e669:f0e4%3]) with mapi id 15.20.6609.032; Tue, 25 Jul 2023 08:27:33 +0000 From: carlos.song@nxp.com To: u.kleine-koenig@pengutronix.de, andi.shyti@kernel.org, aisheng.dong@nxp.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com Cc: carlos.song@nxp.com, xiaoning.wang@nxp.com, haibo.chen@nxp.com, linux-imx@nxp.com, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4] i2c: imx-lpi2c: return -EINVAL when i2c peripheral clk doesn't work Date: Tue, 25 Jul 2023 16:31:17 +0800 Message-Id: <20230725083117.2745327-1-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI1PR02CA0004.apcprd02.prod.outlook.com (2603:1096:4:1f7::12) To VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|AS8PR04MB8562:EE_ X-MS-Office365-Filtering-Correlation-Id: bc1e4165-69a5-43b8-2273-08db8ce8fe45 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C75De7JSSin1TW84cI8TPkbf6UqT1G5UbFFNeL34xgUbf6/WUxp8rJzrGymc/CLm05jcy3ZMGNjrO1r47aA2ExKK7ONhfDinyfmPbXatXj5MG37TOPAyxuig/S/GgkYi8p4BBcG4JqI83I4MWhOIwD+1IZ72x7oC3tEI5B2vSKf68AL77j9P16vSGpkBgttB0BLH/PNsztzpFBj77rA06a+nNg7vo0frkwKzzCZBv3vWN5RvPWEfkOxCfBpT8iY3CjhwyNamDAwStwi/LX0XLSfxalnnsDULHqCOFOE+pnprBq/alBu9TgrMpEYZNn0KgrdmBzb9tHjYOgbysM3ApVyDFUJQ/fzb0bUdc3x4jLtMKo6Pd0Ms0zlXPBfYzT02CAIGmK9lN/v6xXkPXVOMGNALvbaAxJRQpQEXzdFHjv6focrBH7zImEkt3/690CJvfgpnA+CMyhtzr8XeT9frFXiqOc6l6pTLGaRVPxJP6yeYdCrFVcqagxRd3btThxNgd+q/U7m0o7LtTBQ29xKB4OWyh7QV6hKRV6rvYdvZumqM6qI8jLJ8HXHEKRDz+KTah7UA1Esk182HMBHPZo7UnIQ1UIhtUjwwUYUZhvEthoHO5WhNvcLWuo3PTEi+x6G6 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5005.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(136003)(346002)(396003)(39860400002)(376002)(451199021)(4744005)(2906002)(1076003)(26005)(6506007)(186003)(4326008)(38350700002)(38100700002)(2616005)(83380400001)(41300700001)(5660300002)(66946007)(316002)(66476007)(66556008)(8676002)(8936002)(36756003)(52116002)(86362001)(6512007)(478600001)(6486002)(6666004)(9686003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZwaZWpRFVRlXQKHtDOmnnqSHu2j8vboRVFnQJS4eLyLZSCIzWi0evPiNY+grCZFtTF0XD4VcAOvTLeWFis9Kttj8bQ2zelHSQxs/Hv4zwWohzTT8SV8irhd5EJzwFIX7r9IaF9BhSfCIh60CkMf9gp9JqQ65Wc9l7O4Oc/mynoneDzrYPEP6j1vpJ+1bKJ55505I9nGuewwpmNmE62y+x06Qe/TQQMtRx0PnbbWzxE42QhoEMdRxEc8mUqAvA6vIdjEP976ndtxI/RwF3XhAuGAUm1pYT/PgcoLRW8/LC7LVm/MZ+L/b+y9foBc3omiIDNCk3y1zEntL9BwrdfC0sYDh3mq/zA2dCvQNzlFfJa06IttwAg64b4LzyEcVMKvJBTdHzWN/Xan+7NEx3VKJ3fl7bSjB4vpXsDWRQiADXAoiXGM0tzsWKtko3xtWYDD18ZCvNxLricYeJOnyG/VTzjLcpxroXF7VvldPei7KsbfcmCj/A1UiS+MxTiwJRgw8JotMjsrax47UCuRwfMKwPKTlKqd3YIoBiDSbdCaydg8EJDvhgx5VoQSfy4jw4SqUOEXy0ulUTbLYTqN+HoWTmW7oEcdgxiUmd9usOFvLON/7Us2ZXp7d5JQMJYGDQFuc+RXIwQvyeGKPVJ1DdKKvROqs+OzMUnkJjQyBB6s8QYUPmPRpstLF5IddM2TMUL7ojeD+OWGLtmJlM6/LYFv1WcXtR6Dw0gHiF9TvZ9pUXOYvU+hbt9FPxXlHW0m4JrAA+lkZjP2KoCr7O+Ye5ZzbvFYRvrvLhO4znGYYeqPhT0Qaot1USVvi6Wg1ZKGJ09JP7LePrNWkhEHTE5Oqh9j7bT8tvINKQTwlc3LoaD+fWvN3i+pQ9xsfAgrZFd2zi9CsVifXdH6Ru6KpMMbhMIhfT8Z6CNTRto5SC+AB/gutyolqnitboplpNgSUUlNZCYVYs5A0Aj6t6y8oJD0NCphS/AELJrSmJTHBFGInjjMpv+bFx2LHuY9VGKgztzPjjkm7lMCNsM0yOD/tg27PudmDavJmH0rcaZGgOL0d7jeP3woo+wiRK0s3T0gmvAwpVZFpe9OkH+zZlpCuQ2kKhjpDcfpw0IPTMhTxjluE1mUKLwzfTFHM12Lcr92yzPFopHYOTWWsav8vliPlJslFMI5FXJXF7Tb03XpoBpA8SUIdfOSbxqAVwK2mxjW8Pprm101BYYXaPrJckKKAmQpqv6LUu4FZG+ea3YGgjD+L8UWnPExUVvcbAqzInJxF4pCTv0u7USdcKPyQuofKtkyQmJ5ogNlu12xBlzaWazEZUi/6Nse0bpuX73rnIuqvKImpVg90hiKWfEmGzA+sGZUhingOjCTTOw+fTmiH6cFmbetgYz1d+Mc0PJ3QDgF3h9W2OzxgD54rUKh/1FPiA1sB2W63RhCdrbL5+6k4UvD2t+9Zn6q5s/Miuv3vGb4c0S1igSVcSvQGOy6FXZubxd4gMiUuCs06CbK3ylCPlXKDOV8TVXtmFLlox4kYD9FTcaGiNx9heAIAH2axvY1uAACi9vY9Y4bEYI6uzqFnMT88e4iy4hV5mEdn+bYHJildi189dy34 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc1e4165-69a5-43b8-2273-08db8ce8fe45 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5005.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2023 08:27:33.2814 (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: WdXnR2YREnVtJu5PL1UuSHX5on99GJGkFAglZIl8TCoool0v0EAnjpWpNv8gViVC0Z+4zjHREJbny1v7wo/omA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8562 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772386568782748817 X-GMAIL-MSGID: 1772386568782748817 |
Series |
[v4] i2c: imx-lpi2c: return -EINVAL when i2c peripheral clk doesn't work
|
|
Commit Message
Carlos Song
July 25, 2023, 8:31 a.m. UTC
From: Gao Pan <pandy.gao@nxp.com> When i2c peripheral clk rate is 0 directly return -EINVAL. Signed-off-by: Gao Pan <pandy.gao@nxp.com> Signed-off-by: Carlos Song <carlos.song@nxp.com> --- Changes for V2: - adjust the subject from "debug message" to "error message" Changes for V3: - remove output error log when i2c peripheral clk doesn't work - adjust commit log and subject --- drivers/i2c/busses/i2c-imx-lpi2c.c | 3 +++ 1 file changed, 3 insertions(+)
Comments
Hi Carlos, > --- a/drivers/i2c/busses/i2c-imx-lpi2c.c > +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c > @@ -209,6 +209,9 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx) > lpi2c_imx_set_mode(lpi2c_imx); > > clk_rate = clk_get_rate(lpi2c_imx->clks[0].clk); > + if (!clk_rate) > + return -EINVAL; > + this is a very unlikely to happen and generally not really appreciated. If you got so far it's basically impossible that clk_rate is '0'. Uwe asked you in v2 if you actually had such case. I don't have a strong opinion, thoug... I would drop this patch unless Dong is OK with it and I can accept it with his ack. Andi > if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST) > filt = 0; > else > -- > 2.34.1 >
Hi, Andi According to Aisheng, I find that if the i2c clock rate is not assigned on MX8, due to chip architecture, the default speed will be 0, it cause our i2c not work. The judgment will be triggered easily. This is a special case for imx. The log like this: [ 2.401402] imx-lpi2c 5a800000.i2c: use pio mode [ 2.419788] i2c i2c-4: clk_per rate is 0 [ 2.423724] i2c i2c-4: clk_per rate is 0 [ 2.444071] i2c i2c-4: clk_per rate is 0 [ 2.448011] fxos8700_i2c 4-001e: Error reading chip id [ 2.453172] fxos8700_i2c: probe of 4-001e failed with error -22 [ 2.459271] i2c i2c-4: supply vdd not found, using dummy regulator [ 2.465522] i2c i2c-4: supply vddio not found, using dummy regulator [ 2.471913] i2c i2c-4: clk_per rate is 0 [ 2.475867] fxas21002c_i2c: probe of 4-0020 failed with error -22 [ 2.482066] i2c i2c-4: clk_per rate is 0 [ 2.495716] i2c i2c-4: clk_per rate is 0 [ 2.505464] i2c i2c-4: clk_per rate is 0 [ 2.514786] i2c i2c-4: LPI2C adapter registered So the patch can not be dropped. > -----Original Message----- > From: Andi Shyti <andi.shyti@kernel.org> > Sent: Wednesday, July 26, 2023 7:41 AM > To: Carlos Song <carlos.song@nxp.com> > Cc: u.kleine-koenig@pengutronix.de; Aisheng Dong <aisheng.dong@nxp.com>; > shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de; > festevam@gmail.com; Clark Wang <xiaoning.wang@nxp.com>; Bough Chen > <haibo.chen@nxp.com>; dl-linux-imx <linux-imx@nxp.com>; > linux-i2c@vger.kernel.org; linux-arm-kernel@lists.infradead.org; > linux-kernel@vger.kernel.org > Subject: [EXT] Re: [PATCH v4] i2c: imx-lpi2c: return -EINVAL when i2c peripheral > clk doesn't work > > Caution: This is an external email. Please take care when clicking links or > opening attachments. When in doubt, report the message using the 'Report this > email' button > > > Hi Carlos, > > > --- a/drivers/i2c/busses/i2c-imx-lpi2c.c > > +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c > > @@ -209,6 +209,9 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct > *lpi2c_imx) > > lpi2c_imx_set_mode(lpi2c_imx); > > > > clk_rate = clk_get_rate(lpi2c_imx->clks[0].clk); > > + if (!clk_rate) > > + return -EINVAL; > > + > > this is a very unlikely to happen and generally not really appreciated. > > If you got so far it's basically impossible that clk_rate is '0'. > Uwe asked you in v2 if you actually had such case. > > I don't have a strong opinion, thoug... I would drop this patch unless Dong is OK > with it and I can accept it with his ack. > > Andi > > > if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST) > > filt = 0; > > else > > -- > > 2.34.1 > >
> From: Andi Shyti <andi.shyti@kernel.org> > Sent: 2023年7月26日 7:41 > Hi Carlos, > > > --- a/drivers/i2c/busses/i2c-imx-lpi2c.c > > +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c > > @@ -209,6 +209,9 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct > *lpi2c_imx) > > lpi2c_imx_set_mode(lpi2c_imx); > > > > clk_rate = clk_get_rate(lpi2c_imx->clks[0].clk); > > + if (!clk_rate) > > + return -EINVAL; > > + > > this is a very unlikely to happen and generally not really appreciated. > > If you got so far it's basically impossible that clk_rate is '0'. > Uwe asked you in v2 if you actually had such case. > > I don't have a strong opinion, thoug... I would drop this patch unless Dong is > OK with it and I can accept it with his ack. On MX8X platforms, the default clock rate is 0 if without explicit clock setting in dts nodes. So I wonder it may be worth adding a check here. If you're also ok, feel free to add my tag. Acked-by: Dong Aisheng <Aisheng.dong@nxp.com> BTW, please see another reply from Carlos with the test log. Regards Aisheng > > Andi > > > if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST) > > filt = 0; > > else > > -- > > 2.34.1 > >
diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index c3287c887c6f..150d923ca7f1 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -209,6 +209,9 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx) lpi2c_imx_set_mode(lpi2c_imx); clk_rate = clk_get_rate(lpi2c_imx->clks[0].clk); + if (!clk_rate) + return -EINVAL; + if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST) filt = 0; else