From patchwork Mon May 29 07:23:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Song X-Patchwork-Id: 13258258 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 585ACC77B7A for ; Mon, 29 May 2023 07:20:54 +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: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:In-Reply-To:References: List-Owner; bh=7p6BtBPVN1bBrgFL4KgsycsdbwoSnsex2HkWxnUqtUY=; b=ZHaCIS5u4hbpr6 OMoIbP0AcgfCvbE+hsNNaFt2SruN8lo+UDEQbYHyD6/2dRYsvWJh/6boGKBdnMT2LxV3o9RmN5DmP MTERnR7cXnC3UiFemmS4vwRWTtMRF5NJ/1/HoL2atOPr0rvSsCnpTwg+v+mMterwgt/nh4B/SpJJc Tu1yMz2WHxr3eip2vubBqY78Y+NBV2W3t62ssaDirTUrkTEAzJPoHXoOHWPsWZy7gYdKEkslKNEvG +DNl/lvOew4JZEr/cj9MsP2jjqcB56woeU2QynhMMUhD0dnGG64xQggpfOeXUv0FHnfLR6P1RNI/L K62Q9L6oBHN2N+5qVEhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q3XB8-009WEf-1J; Mon, 29 May 2023 07:20:30 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f400:7e1b::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q3XB2-009WDO-2c for linux-arm-kernel@lists.infradead.org; Mon, 29 May 2023 07:20:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ln8XmlJfEMrEWArKLtBcEn7pn6S06g0SOSuduv25bVHbQwHsiqCmZ/XKuuczZCnDvb0BIh/Zc4oP6lXkbpEK5aNO8iJL6H4cIwDVY18NPaT5LNVLJB7Hz2tihKnnnxcnwqQc5fVYz3EeorsOblRuqGb4xsaFHOfLM+UXGIUIoCfOuuuXzhHt4dv2dihL65v3T8tSyJsUYbAvB32kQ/w3LXq7+9Nyf4B8lQ8fYf3CeYlOyBnkE/kRRjdrlNHQ2qQI+iqCXW7fnQRfiUTFbyK2OP8Hx5M9ZWpZwJwGev2dfNSomBgcWbadZAHGOrI8OEbo88gmZVyPBSEIqy3a1yGUbQ== 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=PmK4UQFe4vJS00+y19O7ZSBayNK21oH0iw15e9KcuWg=; b=ZpcEV56xB1jpJKolCNO9zXFTGOiPOtZWFctXwmy9ClDfKm0hrz67/puvcGGMc1u3xml5MlYYbrQSuVtkDnbABieMI8yJFOZrS+NkW6wvVqLriUw7sRMRbheeBW2etUKxuno7kDDAmWT58KQCwvZRDMcI2hqj4N0N1YBzQa2QGzg8UvW7LlBLlvCDUjBR7hD1zh7SGisreXoU/sUXdTuCmP67qNMeZXiJEXlK5uatbglGVZVtv+IyItiiOlpYCRz9kQCEgfOmnyR0Z0wmTi1mpWRQeCH7LgVuMpdGaxV1exmstfxe6isG9Bp/uajrPXpU6z+9m16YnzoDRG101i2clA== 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=PmK4UQFe4vJS00+y19O7ZSBayNK21oH0iw15e9KcuWg=; b=SaOSlOEqeNlHdgbYzRcwRv2zlx5g0tvXnehIz/STPGg8mu3xZK096ItmgSM6NI67LzB4YPMHKXFvDD3Apxh04PZZvz2sqoNqCcIkf50r9DC4XN9tjriO8jqndZe512pcmWtxxcR3va3Vlyz2Cje/akaZPWOkP/NepCVIvMmyuM8= 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 PAXPR04MB8288.eurprd04.prod.outlook.com (2603:10a6:102:1bc::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.22; Mon, 29 May 2023 07:20:17 +0000 Received: from VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::c2d2:71f0:4080:dbb4]) by VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::c2d2:71f0:4080:dbb4%7]) with mapi id 15.20.6433.022; Mon, 29 May 2023 07:20:17 +0000 From: carlos.song@nxp.com To: 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] i2c: imx-lpi2c: add debug message when i2c peripheral clk doesn't work Date: Mon, 29 May 2023 15:23:16 +0800 Message-Id: <20230529072316.3605989-1-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2PR02CA0036.apcprd02.prod.outlook.com (2603:1096:4:195::15) To AM6PR04MB5000.eurprd04.prod.outlook.com (2603:10a6:20b:7::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|PAXPR04MB8288:EE_ X-MS-Office365-Filtering-Correlation-Id: da741867-bd9e-4024-2964-08db601526e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SA9nFhesbn62Up0OmkEA1FAZFU5iTyU7n7aRKAaTc9ChY+CgLI5x45IZ1rrnLCB4RChOngBgyHtWn4iHP86uuqooGyiszlunucQwJkYYNn8za07jgoYlYl589CvTHSxp6uceRkA0Zoyr4sKvyj/OZcMNO+PzB6VyKg5lGbGNSz8PMFq3hHzbxDVbjxjJRin5yN0X5mVVxOaFkmDmEQVxIqPZZWH59Y2acbIrQlTMWx0JrgClVj9OoTwPOpeCOyv479UKA4StnqB+KD7YC1p5SwzaeyyG3YjVIt9tnYZiVMovjffFHcAj9T0OtKoafkZzbribCHdrbDub1ziMNjyvGBmNs9XRaUP/ulAM+5OmhPfLyNWdJiK/mjxnEuV3fzXyH1xRIKr8864Sh7M+IVjuNFSXPkOd0DvaU/5Tq4Rj/j1iEAnJgncIkbVvPSYGxG/lzegS6NTBTho/8LMh6m0/hWz265j3NfUwNXCSiRg2t72hKc8Vfia0ASunk5IO5zyH6re9xS/RrbsQP33I0EuCMpBnGVy2odKp0QkBET9+5j/qmQxHLYxVdmuQKx8rnBiQ8gNHJVXy0YAawT7p9NsNKhqoEbpwOn0LZzOeC5iZrNMBQnSeA8orxvVGpcgEWFLN 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)(346002)(136003)(376002)(39860400002)(366004)(396003)(451199021)(83380400001)(5660300002)(316002)(66946007)(66476007)(66556008)(4326008)(36756003)(6486002)(8676002)(8936002)(41300700001)(38100700002)(38350700002)(52116002)(86362001)(2906002)(2616005)(4744005)(6506007)(6512007)(9686003)(186003)(15650500001)(478600001)(1076003)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B2q51tY0Qw0MVZ0O8vdS0mYOC7NDi0atXSvdeYU3prrJcuEYM5CE3Z38yeVf6ZltARTuNob9URs/Z8cwETkzeWDlRjFClfYzKEfXgFOUU2B+hpHX/KOV1tjn5jeUOZVevfL7WM6ttd2oaJmtY3DBkFAVg7s1w/F7Y8L45E+DWZmfW6shsbrJr+0j3MCoBcIKz24qHU13uGVRKp9B8XZ9cYVtCsEJvoEbepO4O158ITSgLw7cFZnqMPScTgNAMsBx+NMdXXBRiOLe9g4iPvd/BVfvnE99xfF1GvW/ZEADxTryAYjqN+ZDUh3GbYtE9wASuUcHovRD35UZ9/85b3dQ/FF77vVEnlkK51pDe+/QyN30Ca4Dw7RSL650oxYJ2PKa+N47XIV3Vp1zte1iBpF2YXdYoHpp5A+4e73hFAtUWqQ8d+ChsBZX2qFc7ILyjq056WmZ49xMrS6+yyfNkTSW+cZNxffEThlAid9sjfm33TZQN4jBVVNhL7U1pBGN189mXA9c+23V+cEXK6APlMt1eBlshtbrQyBHJjy3sgYaubhkBHzYteeT/Z/aLR64+iG66PzNa4I/jsCyir8HLG96bgl1m8hm+r0Gw2qPMk+QtpTT9JkHaUizrqcl+b42P1iaBfzvueUwmiPOCiHRSUXXIntG0lz8NwLA0MtZGxtRhOQtr6vxAgUp63p0F10zFNA3fSb1WKkMJrMz5IU72g/Fxw4e6/NMEv9SP6NF1fDNOAM5RLEE6uRfu3kyB/GHwTXLsAu++HgHYW+ZQp2g86VCs7SFSaTL5wSe3VOIQM5G9Z45JWZgPRjift/v0HXIkam4JZXGFQArSkB7Khy1bhHWwewbG/8NohyEOWp9JXBIff+uarxH+geG63vA/IGjz0TvG6CO3uTjBAlhenqSOR9h9uWUct4UWZGUGOhsO5uHRzOREEiAHLWU8YNypKeV0l1abOfNXAeFJlYhjxFQ5tdZ3jVRhkvDJZ0K57475hAI1eAsAFr1Ds3izeakB+sAGouoRw7js/WPwgpGpnL3hbkIn6zZl0ihcVphb90d/LJeukuzaAlPRC7wUBgPPYVwrRGFX4Qt3kMX2orJ8dcaxc/i7lP00I2qaWTxL18Zyb+3XEqAG2HiAmQswbrC7wpVTVa8759XPh4rUsWogY4Go1O3na1OI9XJWUi7Pl4+EMzLVyvoFqvtI7/NSUh2CTGclXjSOjVo0op8dOFcSeg7UJKszcooR0a7PdikSurrPD7hjfN/Sqtp/yQU6wNi4pMfxr+6WpDsEFDuhMJn2k+ytfggl62HNOVcgpufo/8Q2bFgebc4X/lakSTjDJ/+RGKPeveZ2p8IEFG8K88iSZKANXxGLmIp4rqdiyIRGw1cu6aw25sguFq21X5sdYXyRM5KphLCM/6CwLlw9xTcef2nTyNLzO5YErxT0vBm1t6c58TE+iRfhBW+Jf6iNGSe6ReqUq3a6g/dXLfcXygyBSY7T3vE8bh5dSng1uF/8J+Iy31Yfb7oNYclN5OJnpNTmVYLSTdsZzxmF9vvuIpsgfRH61zQiKtaHYPLK3j80vG9uyF5cKWRDnRm7xdwbengApsmQzOq X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: da741867-bd9e-4024-2964-08db601526e6 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5000.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2023 07:20:17.4678 (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: Gld7t4rq3oYF0I1NEI/SLy+2sjLW0SvK5dKlFkS40B+lB7AfidDeU09fMtQT+VLvrZQjzf69MkmswsjuTjoYMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8288 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230529_002027_634579_B89E7BD1 X-CRM114-Status: UNSURE ( 9.91 ) 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 From: Gao Pan Add debug message when i2c peripheral clk rate is 0, then directly return -EINVAL. Fixes: a55fa9d0e42e ("i2c: imx-lpi2c: add low power i2c bus driver") Signed-off-by: Gao Pan Signed-off-by: Carlos Song --- drivers/i2c/busses/i2c-imx-lpi2c.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 11240bf8e8e2..62111fe9f207 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -209,6 +209,11 @@ 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) { + dev_dbg(&lpi2c_imx->adapter.dev, "clk_per rate is 0\n"); + return -EINVAL; + } + if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST) filt = 0; else