From mboxrd@z Thu Jan 1 00:00:00 1970 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 2C0D0C71153 for ; Tue, 29 Aug 2023 13:33:10 +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=HgszB0uKs+P/TbzlDufgHQ1huxYVk3XSxTRsXXWYOzI=; b=OOVfCPedPundXL 3tIlsckL0Qs78nee3oKpFeOf2qqQk/CqCEDN8qcqI76yrOIXLRamrF+j3+xKWL4yL35oSGNEjj2ux XmiHfX0X2rwgeZRyQfLtjyrQ8lBVwvtn6NjdzSe+5tOyvURuggjw3GqJt9i/mK4MVQxjm7WKVfHng Cr1CdftIGvQ+xfdV61ENQL7lfuBekQGMST01GbQoZM3vRMu1IlOlwztjmupEbBiK2x/XEbocOsTh+ 4fQ3PWfPCJ8X3+TR61A1lFOtTBjPtNiSqCBvA/19K0XhMZC1NZIBi4JgLFt9deOqiKdQT8J+PBwqD JgSoWhSRejRBRg5H7mPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qaypr-00BbeV-0O; Tue, 29 Aug 2023 13:32:47 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qayph-00BbYZ-1P for linux-arm-kernel@lists.infradead.org; Tue, 29 Aug 2023 13:32:38 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DFF2465743; Tue, 29 Aug 2023 13:32:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21693C433CD; Tue, 29 Aug 2023 13:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693315956; bh=8BJat/PnflBGy2w/90xhTxQ3qWxwanl2fKWzgHIxuY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=htrP20m58TDxn/rMgMu01M+GIejvxVRGkXR/OlwBXw5WYsRptnoUMlSQGRulTAHJE MW7Y2cmddHebn2ExafjIsh//HZ4400+/gOpXJdmv6TLQ2XLYasqYCrlCCjRUGxJesm MD+O6Y1jBfI3jvdZnsclCpNt7w9IPQpmfROar3Qs1/UIXiK7nNVNfRzpTRWBkzH/o7 wed5StNis6mSsNDaPX/7p0A2aRj/J68neKHqSdpenrSTKupRtrQb5bnAh1xq+YMWkP 1BYCsQKKnbBWrIgc0Mctk5dON5v6+qx+g/eJRBeSyDoIPYMRjuHVHv2vnrLi5FD48s 0BgnuE5uv+ONg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Carlos Song , Dong Aisheng , Andi Shyti , Wolfram Sang , Sasha Levin , aisheng.dong@nxp.com, shawnguo@kernel.org, linux-i2c@vger.kernel.org, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 6.4 13/17] i2c: imx-lpi2c: return -EINVAL when i2c peripheral clk doesn't work Date: Tue, 29 Aug 2023 09:32:00 -0400 Message-Id: <20230829133211.519957-13-sashal@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230829133211.519957-1-sashal@kernel.org> References: <20230829133211.519957-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.4.12 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230829_063237_518585_DA9A103D X-CRM114-Status: GOOD ( 11.09 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Carlos Song [ Upstream commit b610c4bbd153c2cde548db48559e170905d7c369 ] On MX8X platforms, the default clock rate is 0 if without explicit clock setting in dts nodes. I2c can't work when i2c peripheral clk rate is 0. Add a i2c peripheral clk rate check before configuring the clock register. When i2c peripheral clk rate is 0 and directly return -EINVAL. Signed-off-by: Carlos Song Acked-by: Dong Aisheng Reviewed-by: Andi Shyti Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-imx-lpi2c.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 4d24ceb57ee74..338171f76daf7 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 -- 2.40.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel