From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 A665E3ACA45 for ; Fri, 17 Jul 2026 09:40:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784281210; cv=none; b=Q3wRnArzuJv6zwzUSviOwBYPYr54gZW7o92px6lYTlMpcqEQKfWv67asVjvNyvkQMAmmniLQ3cb+lYqgh76u0Vp0va8pu7JWfx+YiGaQsrVybXNKh6GEfSdxDq/iCo6DMpDgXptcfuj1vylruaZt/6fmrCT/oVtzvwVtI6nChZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784281210; c=relaxed/simple; bh=YQCwk4bp0PA+qHQsrjsOi3zVTZr/VEWJbRm3ea+juEI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=X7UmcC9P/ev1Q0DO/HpReC9h4Kgji1RF7TeC4VAmamL4yCOKFevkiXiCNIAOQwKgO35vSYX266xK1r4sKJQVIraBNUYr9QNR5u5H81sa2lVH4qnoNqrEkTs/F5IT2W+MZ/s9BD5zzzGE+VUeho7vvc8z5+xIZbl30BiHSvWBRBs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=WY113k/I; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=DiNRvAC8; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="WY113k/I"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="DiNRvAC8" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66H6cH1q1160842 for ; Fri, 17 Jul 2026 09:40:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Dcpk07oZraCPhKGl/8f8pKfXbK+a2naoxCJPU/iKJq8=; b=WY113k/ION4MNi8W C0TvnMk2KuNiT67xrQD70k/4Fba1gqvN0HwqZOEvViG7Y5jKbLc2y8YwpMty6aJF xO1REocUs0tw/ppl4wtmEbckb1TIya6JOe7yrHmilCEP/N/ZSwQP+DRqzKYAMBoc WlUKywpMA47WrFYqiSVEqtS1l0scGI+vQ+OY4QQzGL+gHL7Rv3yswj2+bbxw8As9 aSCjY3NIDpAcDFcAelEEizj/4+5vyXc22L7TVUufkQfTr6qxsMEDpFhE2bu///L9 YKjvuQJaxhorOhLJwZQt9q3K8tAuI9llkx58pz1G4ezlZwJmC18PTb+hExtEG7Iv 8IXPUw== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ffd3as60d-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 17 Jul 2026 09:40:07 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2ccd1958e8fso57780365ad.2 for ; Fri, 17 Jul 2026 02:40:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784281207; x=1784886007; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Dcpk07oZraCPhKGl/8f8pKfXbK+a2naoxCJPU/iKJq8=; b=DiNRvAC85LvFoo2VurQZuZIhwFDgAf4Dm85Gsj8QhismYiGq33tACRpYE9ue2aroGI MQanPGAcdVO+9yBoWaHU/Zof7bo9b6j87S3JIuzPjmwYrYj4ux+a3SGqbXRmFkqMtIji Q0jSLqFRS9y7WZxYi/8+NZs5LucvIiClbZpC+COtNBLQKdLIIEGZO6Xc8ChTsMXnRgoX qZ4idfbTqnE8ObeShoh5fGGv4MJUonV4bsVjGmhmmb6z24KfRuVcyP0kS64ZRONOEDnP lipQdhPQIznTXnv4HaK7FqkSOUDj/fXgHQTs3hWzSdoWPeh2uMpI1BtFIVk6W1X/sLDM S3NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784281207; x=1784886007; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Dcpk07oZraCPhKGl/8f8pKfXbK+a2naoxCJPU/iKJq8=; b=enZZpuYTJH2lJWjYAfSJlHT+ljs6TxMvn5eGCGI2p1wbdLacOxHpBsLryEPeFdVHA0 FWekGcs3WI0wzMhdnvMyWsgIEi36HBZ/uJf6WYOcU+vZNT3ksQ+EiG6ZM2nUv9gWDLkO w7RI1NrtC+uhpuZOlY0+WuRIJY9WPt7PfYV3NGiVdKY5/xrO7FKl18fMstpjw4csx/my B6Jofd9UZRuLHb4K19coKsS9Yy93OPDzllVZyAA/+rCrbb6W+3/OAupQtpPIKrO1PU/2 jcYbQ6CZIyZE4SCD7/brvtIegVBE1sUD2EU2t9V2RNNhJqLcX2VOMjr8JkpjkFvwD+Ti VcsQ== X-Forwarded-Encrypted: i=1; AHgh+RrvIMex3J45rKVytkOMhWXt8xBFUZploFNcK9QeVwTEEDpn8ihDjnvuIViglU44TDTyNlQiA4sBs9L27qE=@vger.kernel.org X-Gm-Message-State: AOJu0Ywj3mtJi420EdEdm09n+UGVKsFS5TNtYO+yS3SNriz5KheRIKcO Waa87hgubtaMxRgnGFUq4Tb3IF+2Y/kpxO20qdAKfwz608soS0zxW4F0mmyH1ZTHcTXKdoyeFYm 2ogFAAi/LyHKbzxAiTX44X0QR2ytsG+c+ZBtu+LYzpw74wBHtGdaQaV5kBAIBtD0u58o= X-Gm-Gg: AfdE7cmaYEboUiFhZwfuS0WGb3XIMzIiReWYivM6wnL1qcSJXpUPA0RoHmAvYdabfgl ofjF0IpLjHr61OE5+LKa1porEzfejo8ss8tTuY97eFjsJCeTfBO2V0ZCP2KYQs1GCoQiEG5ATOm 1b27y1quXZjgslvHP/bcRKHxyqIffA0t79FjvpVYS+Fo+KcmcnvV0siygtbVc0k7lajSLvzyveQ /oidu1q4vIEFh4vvSlyYZDzOxjfLv5YJ8XBvTivyq2vM5Knrh1Y9B2uiZOzZYPsQ5us4k3ec8wf UJh64uLT7Jx4VmuJJjr5Mat55PVjRKYdsssFgjVhMppHj4njvc+lcpNKSnAlLTjMmZ+uz2IJ4HB I5X+yGn13+QNNfgomwLN5cbGX3iJ0Ft9P4Lc= X-Received: by 2002:a17:902:f70f:b0:2c0:b6c7:227e with SMTP id d9443c01a7336-2cf3485048cmr21452805ad.5.1784281207236; Fri, 17 Jul 2026 02:40:07 -0700 (PDT) X-Received: by 2002:a17:902:f70f:b0:2c0:b6c7:227e with SMTP id d9443c01a7336-2cf3485048cmr21452515ad.5.1784281206807; Fri, 17 Jul 2026 02:40:06 -0700 (PDT) Received: from [10.217.219.142] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf344f4481sm7545845ad.32.2026.07.17.02.40.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jul 2026 02:40:06 -0700 (PDT) Message-ID: Date: Fri, 17 Jul 2026 15:10:01 +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] i2c: iproc: reset bus after timeout if START_BUSY is stuck To: Jonas Gorski , Andi Shyti , Ray Jui , Scott Branden , Kevin Cernekee , Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20260717085507.34209-1-jonas.gorski@bisdn.de> Content-Language: en-US From: Mukesh Savaliya In-Reply-To: <20260717085507.34209-1-jonas.gorski@bisdn.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Info: AW1haW4tMjYwNzE3MDA5NiBTYWx0ZWRfX31X+GQq7DPXn CgZCwX5PJDMWiTeAYw0p4APQgS+HEJapJDovpMgRkYqqw5cVm/F/2MwfdqTCtIr2Ju7DdAPNOir 6xpKD8rCyRMlz9Y6lmkzZZWidTQzhdk= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzE3MDA5NiBTYWx0ZWRfX9P9u0Mi5nxzw 4ZodTOCdjcWll8LAr00t3zaHYly49EPa6mScqh2IHk/i0qQw7/XtIpnV4QqBch6yqEqpJ2V/eBL W/qbxqxkixCZzQQPYC3qBZMWgJ/C2BHapSI0o6tbCr9/hFSAIpcpSUszqzpQBiQb4BND08GAA5H fAanNNykEa7gtMT1egT/ppQBMeandPNXxI4FfMcx7qn8urPxN3B2tDa0KJFgsNEL7Ga6lNSj/Gh TkswU+X96KEHO8V4PO9sS+faEa2WbWvUC5oVotMrXcvTuzBIsBO/QcodoTIvz6Nf78g/GuEVWiu 5Chmnc0YCiPpjxHpuUhbmtSQy44HSoHCqvglSAjvXmGsujEM/gsINcs5QQFMK0n/zaSPG+7RJ7J qNkeS18SUqYbOyaxLkmuso5Z8pQODIipqIuAitdYhComCSMdVY+wkqVQ+VI+bWhqsLJrSTy6Nxz 6xzzaGc+/1yskhxSm2Q== X-Proofpoint-GUID: AXrnaTliRaJwvXFUBojFGeEsV0XrmXFS X-Proofpoint-ORIG-GUID: AXrnaTliRaJwvXFUBojFGeEsV0XrmXFS X-Authority-Analysis: v=2.4 cv=e/M2j6p/ c=1 sm=1 tr=0 ts=6a59f877 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=vjGmwFoGhKkvse4UqjwA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-17_02,2026-07-15_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 suspectscore=0 phishscore=0 priorityscore=1501 spamscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607170096 On 7/17/2026 2:25 PM, Jonas Gorski wrote: > If a transaction times out, the START_BUSY signal can stay up, and What's exactly START_BUSY signal > subsequent transactaction attempts will fail as the bus is still transactaction => transaction > considered busy. > > I can easily trigger this by attempting to read from an address with no > device, e.g. when running i2cdetect. After the first read times out, all > subsequent read attempts return busy. > > To get to a working state again, the controller needs to be reset to > clear the START_BUSY signal. So check for START_BUSY still asserted on a > timeout, and do reset in case it is, > what's here after it is, ? wanted to end the statement ? > This is also done by the original non-upstream iproc-smbus driver > implementation [1]. > > Works around situations like: > > bcm-iproc-2c 1803b000.i2c: transaction timed out > bcm-iproc-2c 1803b000.i2c: bus is busy > bcm-iproc-2c 1803b000.i2c: bus is busy > bcm-iproc-2c 1803b000.i2c: bus is busy > bcm-iproc-2c 1803b000.i2c: bus is busy > bcm-iproc-2c 1803b000.i2c: bus is busy > ... > > where the bus never recovers after a timeout. isn't there a max retry count ? > [...] > if (!time_left && !iproc_i2c->xfer_is_done) { > + /* > + * The controller may fail to clear START_BUSY after a timeout, > + * reset the controller to recover in that case. > + */ Make it simple ? Recover controller if START_BUSY signal is high after timeout > + if (!!(iproc_i2c_rd_reg(iproc_i2c, M_CMD_OFFSET) & > + BIT(M_CMD_START_BUSY_SHIFT))) { > + bcm_iproc_i2c_enable_disable(iproc_i2c, false); > + bcm_iproc_i2c_init(iproc_i2c); > + bcm_iproc_i2c_enable_disable(iproc_i2c, true); > + } > + > /* flush both TX/RX FIFOs */ > val = BIT(M_FIFO_RX_FLUSH_SHIFT) | BIT(M_FIFO_TX_FLUSH_SHIFT); > iproc_i2c_wr_reg(iproc_i2c, M_FIFO_CTRL_OFFSET, val);