From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 633D73D9690 for ; Fri, 17 Jul 2026 11:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.167.43 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784286560; cv=pass; b=X4ElTfQCDLRSHzKeWD8yKPmxheu3uIB7k21QFJackfT68WDbFm7gL3qfn9FSgHmpceeZbQRVdvy9n60P3i63skLPowGl/cpk+89CGuXdj6kUDc4LoXrYhvGrodZAo5parRCdaVGcXBJ71JrAg/lpZJTxMt2vOMYeTKXfW9hFiSg= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784286560; c=relaxed/simple; bh=NQEYEBoyqjqknpCw2ohp5AC8OUnw9jB9IsqAEmf8A0s=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=jfpue4faHgatQSnb9RSskY+C74Wac2t+S9Xpf7G/ITaR71CpI/D6wGWxe7WFkftJ9UbdMFE3N2d4fZDHFM24z670W/cQiM+UXWlOfz+oUaqeNLojVRtDjUb6tE/m2nu0NcRmxcwrIXdBdmDlE+lluj4TIhHwz8+8VV4aynOkZTE= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bisdn.de; spf=pass smtp.mailfrom=bisdn.de; dkim=pass (2048-bit key) header.d=bisdn.de header.i=@bisdn.de header.b=CLSNiJce; arc=pass smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bisdn.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bisdn.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bisdn.de header.i=@bisdn.de header.b="CLSNiJce" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-5aebf96bc89so1189098e87.0 for ; Fri, 17 Jul 2026 04:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1784286545; cv=none; d=google.com; s=arc-20260327; b=SLBtckXywJ1sZTC6emrC46e04YaOs/M+Zbj2VMaapXNEL5HoYlw3i1Cn5UtOnljv2k K9abPUdG30Sgwa2jDSFEER203whCaSOBZK00nPzAZgaIVRdq8d9UxOfmSgseBZ6wlP/K Co5IsQa14OJ3D41r5+9dmbkUEUiUMAEsg10/fp7GvqofTnUZ/NNVtOz0G8X5PWgtZYAF l6aX7lZOg0IUg+5UOxlxvRIu0Ayozg9HWB1AwG1yg4vIkP+uyAGf9XsGtS6sZpYlNhk6 1TY4bxUk/cSwKbVhCYb0lTqUgKh/TNEUxa43Glvs5/hd5ug3M4ORXc25NY9QjLdeHRND xCgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IVMjIqA5wERc1VK0TSVspzDmfYe5coCITH1bpAnvXTM=; fh=mPY+TlqdS9/vX6GXuX7MOGNw2zQhFJ6DJYhTLRYcqtQ=; b=sbXefa8NobvW2r9G0/6xIwbCOzc9NBH6tdpA1ufBo1gkPBySgrdGBbyB2DGI3V9PKE QepvBkxOGRrDJFcFKvQjKzVFQV+VpsUqTBJtDyA1/8uemhhcnZ1dKQ8EqacwoWPoU4K6 sYwt98drxNee7VgYYvoIpn7W2tpie4IaS9kafYV/+Zfl7skUGAKw9LIgo+fK3biFw+H5 +hqIhkZVPB8YrnUzu6AD5QjKsDsFwyBGBjjbf5cnGKqjq0dQ4gEpv/v51/u6muS20nlF +7DCOazsaJ2mGCr8UzYG9UymUbAXLNaw+tvMgv83lOyYVqXLyZu928Ihns/k7cLffDKJ DP7g==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bisdn.de; s=google; t=1784286545; x=1784891345; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=IVMjIqA5wERc1VK0TSVspzDmfYe5coCITH1bpAnvXTM=; b=CLSNiJceAWBp6jDn5uFq7scWBfUDwruVLMfEUh8G97Kav82NDqgqY90HWT9wOjVKl3 tTh7BLuHcyX27VANamW9Pyn8fxkMQscEXUwqSrZGq5M+FZ5TUX7dcZ4T1tzYIALpBlhF dFA85wIU/zgV0uJYlfZ2YwSNijHNIq4HVDNmr6n5NvM/860ogPziI62w3JXQSf1Gwm79 hJ6f9T/lPtaRk/HDa7Ijk/XP+Aery165Ye/MVwkjPbCIFvA/XLngUZkVyJIE74764e/b 8FsSF0+mtyoHaT3m5GmMVXQiR+sLd3L0ILKngziFO/L/IBUBkxQaVJxUnRvLIb9+AI83 aoug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784286545; x=1784891345; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=IVMjIqA5wERc1VK0TSVspzDmfYe5coCITH1bpAnvXTM=; b=fWsFPd7vxGoEst0Q52AS1L3IaeM5s1B5IDk1i1eyCZtkDq5r8JNCWvsitSPvMdUobv 8sxc1Bs6wbgy/f4ts6BdVzciSwGlUqKqmlp01HTD6epeLGnSQ7IAqIuqoY0eDFXns+B9 2hkWiyOLwHdNIoevmV6poJcgDg74ueaB4XPUZUEnt4zpBtIDfqj1ngxQ6fKudnrhe055 JpvUoV6X5tIPktyW3vniTgqzAfgegGztXiwFrTxEnobmV8eE8ATr05Zs0UT0yzsPb/yC y5A4rx8SA4/bycmjIwNpGF9XutTBIasrg6BhAIdWiwESKGZO0wNtT0cU6gqTKdjp22x8 RYag== X-Forwarded-Encrypted: i=1; AHgh+RqW3pXfJzCe1v/bjhRI5ODmvsfBY7Cs1odhdcfV+7nu4kUWpOch36ZpX7/abgUHe84Fc93cpQ3W8AdqiTc=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+EMqqwKchhiOEh9eRYxlfLgtgK9ay9cjZ6xH/S6LHA201TMkc E3Ht06VVTLSsl2p9u87kUYXcFLTmkCnDy9UCZxrch2FVwegzF+FAX8i4bIisHmUdV36NuRLlxJw phnPgZiO/GskM6gzGUe1ujxFwtXUOcg1Z1FU9RSM+eAHDBu8iBY2iDWGTs94Boeq/giPyzFGzUq q33v6fd1S1adVc2X4JhUi+29oRu+QNnqXhJA== X-Gm-Gg: AfdE7cnc4CyW11EyLxWjDTw5wsgd4cneGAaFcXHTpqCeU7CbFvVTbNiOhPksUsQos8D EiN8WI6ZSKkg3h8/69nzxKGySCNdGy8PyJZrzaZu7tRpaCch5ItXlJ8tWpuMFozsW1PjRmVIUFM LecCl9Aba8nBi4jnIikbrnVYLjDk5bRDzOe6voIo+P6a3qxJX+vFv2OupKr6l+59phKXwJn++XV EJz1RF+QEG8p3PQgFAOUzT23ueoGqlT9fbt5rhjHjyzX65I1A14CPFINWEyIehH1nQfMyU= X-Received: by 2002:ac2:51c6:0:b0:5b2:8d3e:723b with SMTP id 2adb3069b0e04-5b28f87712fmr299173e87.1.1784286544689; Fri, 17 Jul 2026 04:09:04 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260717085507.34209-1-jonas.gorski@bisdn.de> In-Reply-To: From: Jonas Gorski Date: Fri, 17 Jul 2026 13:08:48 +0200 X-Gm-Features: AUfX_mw54--TNQFoTYsWHV7VstC3XqvwiGDE0dEj18UkhlySQ3jSOQB47lLuss0 Message-ID: Subject: Re: [PATCH v2] i2c: iproc: reset bus after timeout if START_BUSY is stuck To: Mukesh Savaliya Cc: Andi Shyti , Ray Jui , Scott Branden , Kevin Cernekee , Wolfram Sang , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Fri, 17 Jul 2026 at 11:40, Mukesh Savaliya wrote: > > > > 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 =3D> transaction > > considered busy. aah, I was so concentrated on getting the recipients right I forgot to spell check @_@ > > > > 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, al= l > > 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 ? I think I forgot an "it" there, "and do reset it in case it is." > > 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 ? In this case it is an already bound driver(s) trying to do (new) things. Each busy (likely) comes from a new request. In our case there is an RTC and several SFPs behind an i2c-mux. So there are two scenarios where I encountered it: - during runtime after a few hours of uptime, a timeout occurs accessing an existing device with a bound driver - and recently while working on a different device I noticed that reading from an unoccupied address triggers this also > > > [...] > > if (!time_left && !iproc_i2c->xfer_is_done) { > > + /* > > + * The controller may fail to clear START_BUSY after a ti= meout, > > + * reset the controller to recover in that case. > > + */ > Make it simple ? > Recover controller if START_BUSY signal is high after timeout That's more or less what I had in the first version, but was asked to expand it (split about two short comments) > > + 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 =3D BIT(M_FIFO_RX_FLUSH_SHIFT) | BIT(M_FIFO_TX_FLUSH_= SHIFT); > > iproc_i2c_wr_reg(iproc_i2c, M_FIFO_CTRL_OFFSET, val); > Best regards, Jonas --=20 BISDN GmbH K=C3=B6rnerstra=C3=9Fe 7-10 10785 Berlin Germany Phone: +49 30 610 816 100 Managing Directors:=C2=A0Dr.-Ing. Hagen Woesner, Andreas K=C3=B6psel Commercial=20 register:=C2=A0 Amtsgericht Berlin-Charlottenburg HRB 141569 B VAT ID No:=C2=A0 DE283257294