From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 408174A05; Wed, 26 Mar 2025 04:43:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742964238; cv=none; b=nv3vw7lGXgHDotvdRNVxdwpCdPTmsEDkJkG6ifous3UJae1nO2a95NSgmU54Qf5JblYjYRPe+IyWSN9+4ZLgR9IX9BLPKiZ65bwx0zOK3ydHKeRqBDP/fnN2XLyAT5WhvvsDn6fY+plVdfuAwCclX/4pE8jVAtgiYaKUUWl8Nzk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742964238; c=relaxed/simple; bh=LE0p3PimDXlac2M63hkm7f6IveA9A05ueG1ZF8/JK2A=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=c16JhnvD1Wul8eaWukSZZPisRM0BHhbQ6imFtUSSg+bt8TRBCBdouNpo8T3DZ46WyGMGuQsN7lP0fnw5L7TTiFMoBpNwQJlZuH/BWoD8FV3dqNCrQdi+y0bgOm+up9znkb/Qz9sl6nWrg23TFvRg7pq0AmZN6HlPBJFj7Y9NHWU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=pJMddc46; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="pJMddc46" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52Q4XbXE023552; Wed, 26 Mar 2025 04:43:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ordMkqhPURoJANwH3hW5zg5e3kC1S+uEc5nh5B32xAY=; b=pJMddc46Sbrx4PRY PaT1C7P9CDYlP4ha2yn4gQshzS6byxHd0lV6i2Wa5EmzZriSykW33nRWTrQElk2S S0YHavkeUNvSjpw2bS3PpNxoGqdyL6Pz45ST0PtteSAWLYZoyLoYHp0SqWE4AU8h wgb52PHJ1Oy4BVk0PAoUH6ePlXdmZVm6UEYPY0pO8oU7kJ2E3DIK7ySRd+3NwF/x GUCCoBSWgf2DmbBCw7jXh19J4HvibBd5SohGmJlbwrg6bekGc0y6of1YeImWJhaO 4YN8ez/PzOT6lpasOl8s+lIAu8wUFU5pvFeska7m4mrJ9bUtblzxreyi7ysNWZhB aC+bOA== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45manj00p5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Mar 2025 04:43:33 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52Q4hWp2001689 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Mar 2025 04:43:32 GMT Received: from [10.217.219.207] (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 25 Mar 2025 21:43:28 -0700 Message-ID: Date: Wed, 26 Mar 2025 10:13:25 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/1] i2c: npcm: Add clock toggle recovery To: CC: Tali Perry , Avi Fishman , Tomer Maimon , Patrick Venture , Nancy Yuen , Benjamin Fair , Andi Shyti , , , References: <20250324203233.1266772-2-mohammed.0.elbadry@gmail.com> <20250324205901.1274708-1-mohammed.0.elbadry@gmail.com> <20250324205901.1274708-2-mohammed.0.elbadry@gmail.com> Content-Language: en-US From: Mukesh Kumar Savaliya In-Reply-To: <20250324205901.1274708-2-mohammed.0.elbadry@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: MHwPG1N0QwuRxFb7A_k0yYQtV68e-Nqt X-Proofpoint-ORIG-GUID: MHwPG1N0QwuRxFb7A_k0yYQtV68e-Nqt X-Authority-Analysis: v=2.4 cv=KvJN2XWN c=1 sm=1 tr=0 ts=67e385f5 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA:10 a=pGLkceISAAAA:8 a=XycGwPUB66WHHuA_nGUA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-25_10,2025-03-26_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 clxscore=1011 mlxscore=0 spamscore=0 impostorscore=0 suspectscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503260025 On 3/25/2025 2:28 AM, mohammed.0.elbadry@gmail.com wrote: > From: Tali Perry > > During init of the bus, the module checks that the bus is idle. > If one of the lines are stuck try to recover them first before failing. > Sometimes SDA and SCL are low if improper reset occurs (e.g., reboot). > > Signed-off-by: Tali Perry > Signed-off-by: Mohammed Elbadry > --- > drivers/i2c/busses/i2c-npcm7xx.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c > index 3ad6124be80f..78c85015d955 100644 > --- a/drivers/i2c/busses/i2c-npcm7xx.c > +++ b/drivers/i2c/busses/i2c-npcm7xx.c > @@ -2043,10 +2043,14 @@ static int npcm_i2c_init_module(struct npcm_i2c *bus, enum i2c_mode mode, > > /* Check HW is OK: SDA and SCL should be high at this point. */ > if ((npcm_i2c_get_SDA(&bus->adap) == 0) || (npcm_i2c_get_SCL(&bus->adap) == 0)) { > - dev_err(bus->dev, "I2C%d init fail: lines are low\n", bus->num); > - dev_err(bus->dev, "SDA=%d SCL=%d\n", npcm_i2c_get_SDA(&bus->adap), > - npcm_i2c_get_SCL(&bus->adap)); > - return -ENXIO; > + dev_warn(bus->dev, " I2C%d SDA=%d SCL=%d, attempt recover\n", bus->num, > + npcm_i2c_get_SDA(&bus->adap), npcm_i2c_get_SCL(&bus->adap)); > + if (npcm_i2c_recovery_tgclk(&bus->adap)) { > + dev_err(bus->dev, "I2C%d init fail: lines are low\n", bus->num); > + dev_err(bus->dev, "SDA=%d SCL=%d\n", npcm_i2c_get_SDA(&bus->adap), > + npcm_i2c_get_SCL(&bus->adap)); Should combine logging into one line. First line you say they are low, second line you are printing the actual status, may be conflicting ? > + return -ENXIO; > + } > } > > npcm_i2c_int_enable(bus, true);