From patchwork Wed Mar 17 06:53:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12144973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A84C8C433E0 for ; Wed, 17 Mar 2021 06:57:18 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A0C364F80 for ; Wed, 17 Mar 2021 06:57:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A0C364F80 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=DVltfLxPbRlKIaT0jz4fd5DUKPbTZgfj3w4ZWkg5s+I=; b=BAYkDYMufH58Xca05sO5Kh0tl Qe59poeXkJOioPX7yQiPdfCpXRsgkQ/c+D0WvKcG3WSKZF0vghD1L36my9CpDEwpIvx1aT7u4B4X1 YHWtgKU7yce7+vC4RDs9MUZfDBIEeynjqt0wizmNo6uSL5vsEExt2du90BKso6/iFA8PdEcpVGpz+ 9juQ1FgmuSxsryH6zhysacErC0YAUtSmOcmmEb7fEXViCZO1q09BYOWS3G4KPkLVBzoG1Qd3Lt9Rt JCym6tCGMDkIlY9hHyHSJT81Xow/Bfo0fylTHoCKTlHKF17bGpxyqqBVo9OsM/KJPUg5icgDRud0d K9QfhTsDw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMQ5M-002bYc-7j; Wed, 17 Mar 2021 06:55:17 +0000 Received: from mail-eopbgr80048.outbound.protection.outlook.com ([40.107.8.48] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lMQ4G-002b6E-1N for linux-arm-kernel@lists.infradead.org; Wed, 17 Mar 2021 06:54:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SPeY8SBnuER2qLiDzt0ixN18MkoIwx5gE/OoE3i+CxtPMl44STFNppqGnZlUEWUggsMMIaAqwxiY9MXdpanTXAapFETAeHkOotWBkh0+UdxTv9J1KQ2PbpWbA7J2qAGFcyCPZJAzvnH7RH5sFhVbxtO1P2ZMzZdJKCLqIp6gexE0UjCVlDfcPNIlTvYB6gw2vVxEgzJiNoZ1DgPg4DGvRzvYo9KGi5onaKumlKKwCj+Na4UbGsRQQdHavUXzJBaI+NE1Bl0If5gk2fWcAclC279eneJbZxMfKGIyBYZUaCidIryWniM/kwXWvwLMtUmEfhFTjraNzZRk5G2+9ate4w== 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-SenderADCheck; bh=xDxjwFrFhj+Xb4ZbEYW9R0HtG+uvExh/1+L0PbKZQgo=; b=XDybOakP7/w69NR4gu/3FJVNnJoq8Z/xukF/t3a6FmjohWkYgToUQ+x6Jsb01lsqiCtZIzfdXIzRTNxpcXlD3K+uEJZYpC8KGHKInfSRLtpAQqAcH3Lwds6079xLFApCHgUN7u2oP9voH+2BPbFuQm/QUdSPdbKFClpIzW/ALNw9F+lFVStp0jDhBm6rxWMHt1kO/Aq1Cew+pgEzuFnJrGOE6QQbwx1h+LFY8Vl6i1wOQZTmwGDS1IVRn28ivL3y71EhZ8HLljkVb3h/kFNX/4MxzngltgES6P79DBcDDARF2siYR69s7vUYD6ldXNoQH0A19SDij39HqWV3tF64VA== 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=xDxjwFrFhj+Xb4ZbEYW9R0HtG+uvExh/1+L0PbKZQgo=; b=keyfHUMtzu6bJSBFR7kC26uJrvtp24tFjezzioe4xMh8asLqYqp/jH3PkVFCrV7O2rHbrLJ5JukJsBEr6e5FAn3HRPYSz9hHxiABSASEnhEfcRK7+Uf6otoXYi9q9Ju/jGuCO9i2j94m7JBMFVdAOE9S+YCepiMZdlIjOK5diU0= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB5618.eurprd04.prod.outlook.com (2603:10a6:208:123::11) by AM0PR04MB7091.eurprd04.prod.outlook.com (2603:10a6:208:197::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31; Wed, 17 Mar 2021 06:54:06 +0000 Received: from AM0PR04MB5618.eurprd04.prod.outlook.com ([fe80::69a8:a768:8fa1:7236]) by AM0PR04MB5618.eurprd04.prod.outlook.com ([fe80::69a8:a768:8fa1:7236%7]) with mapi id 15.20.3933.032; Wed, 17 Mar 2021 06:54:06 +0000 From: Clark Wang To: aisheng.dong@nxp.com, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, sumit.semwal@linaro.org, christian.koenig@amd.com, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/11] i2c: imx-lpi2c: add debug message when i2c peripheral clk doesn't work Date: Wed, 17 Mar 2021 14:53:53 +0800 Message-Id: <20210317065359.3109394-6-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317065359.3109394-1-xiaoning.wang@nxp.com> References: <20210317065359.3109394-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR02CA0215.apcprd02.prod.outlook.com (2603:1096:201:20::27) To AM0PR04MB5618.eurprd04.prod.outlook.com (2603:10a6:208:123::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR02CA0215.apcprd02.prod.outlook.com (2603:1096:201:20::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 06:54:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 27f2fe57-cc8d-4472-b736-08d8e911752c X-MS-TrafficTypeDiagnostic: AM0PR04MB7091: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XJoAXeGe0TSpeF7+iLiUNJRMnS2nU+Nw+kYl5OVyzz8JymT9s201gSNlLdIzPoPTsTRxewW7F+k6VqRyOMODmZGP3OKxg7VmGk1TKHjAdcgDOlXpJqkqVeNiZygka6p6uxSc+o+eqxJxk3JIReCIroQ0JQKrEO3kOXLhBTTgURpNPYN4UelRxj0ZUI6HAww+xY/D1v3VPXpK9m3e4kI0PJRJUIefkh/S+RLg12NI7BuKKVmuh78iC3KFv3+m9Pyy4FgnUM65cwEAOOhZPMoaaCz2SxkuATHTUzdv8tWCkNYLqSBsXKKYHkp+GcxrM/GQ9l6qlk4gx4yYMY4ogE56yTKSHunrru9PblXhIbBKDT1GhW7cMYpa8s3jXgYhv1KDL1AVUC6n8W3nE/TjVI8Rtn1N0HN3VR7Zg0lBgmxbxKMOtjLvlDNV/uNS9v9WkqSpfp4Nl/1oPQgI7FGMyyVBBQZ2AAhKetsjuoBGzk1iQ01IxU1N6hn3aO60GDlHJmF7nguV5zaBc/3VcHimun1iRypZbk55o0m8rzEKIZ5N4Ma0FgY7kdtIhL4f8aZ15Q+T0qJM1GxenxR0nCOGSU/hXBRkQrOfKFg6A0/k59FlWsqQxsogyWacXVYFRyWDfKHU X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5618.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(376002)(396003)(346002)(39860400002)(136003)(478600001)(4744005)(66556008)(66476007)(69590400012)(6506007)(66946007)(83380400001)(36756003)(16526019)(5660300002)(2616005)(316002)(15650500001)(2906002)(1076003)(8936002)(26005)(52116002)(186003)(956004)(4326008)(6512007)(6486002)(8676002)(6666004)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-A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w29dhhUicYHOgenFpTIz5DWc11hFy7xPv0jwwHJPkN2OcJq6Sz/6E7XK5ZTl2hNs9YPVjrjOSr7hn4IMXOl3ooAjbNjb4bIHwUOkXgxNY/e49rnMf05C2OIwZqTO/mnQpefc783PQrqrFSaLK6kDqDNqxDvEvhVX8+8uGtXF4O2y/UfjOzFaOfmn9TV14suCuZW2Gu5BlWL6tLVzi9gxQWuOhhbRgoCmHMYAS77uRffCSecZvdB3cEUv6vjAbyBUoyQ20eLRgybjLAGXf X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27f2fe57-cc8d-4472-b736-08d8e911752c X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5618.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 06:54:06.5524 (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: MrXj7joMJFP7k5cxp6/4Yf6JLv+pYG9owXdqJjj/3iWmXu4MyaWh0iFLcQrycf1BFyX8d6oBdqDhJLbrmWV9kQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7091 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210317_065408_452956_621CAEE2 X-CRM114-Status: GOOD ( 11.84 ) 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. Signed-off-by: Gao Pan Reviewed-by: Andy Duan --- drivers/i2c/busses/i2c-imx-lpi2c.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index e718bb6b2387..8f9dd3dd2951 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -209,7 +209,12 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx) lpi2c_imx_set_mode(lpi2c_imx); - clk_rate = clk_get_rate(lpi2c_imx->clk); + clk_rate = clk_get_rate(lpi2c_imx->clk_per); + 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