From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 E41493033C0 for ; Mon, 26 Jan 2026 09:12:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.208.53 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769418771; cv=pass; b=aeUqYYwcN9mwDPZGvO9VHZupIoPpuNvVVkYSRKripUj64quz+u36GUAJWlq1NEVf55yeegdlVRRGaRvnctHhQEX2klHMFalzxvReb45a3xwCEb5ETRAWk8U+TqnwIa0n3VVq3F68mAvNa0toqcY/YF5kfx0I9Gqs+qLlNj6Q01w= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769418771; c=relaxed/simple; bh=vniLXzKHNspJD1FrLmGqcx0OX77epShC8YHjddOyZr0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ElKxx53QdSZJC/iCueHmorq0N/15NgQdwhSZyQRcb2/w56O0jSEel81xco+RNYNujU5Ls/P4mwJN23GOol1F2ws2Z0hDM/X87LPRImjWDiRuEI5W7+A5mBOFI/VR580rQX3WCi5lxYAhQu7kfbXlYy8GJd4pPm2F7v1yzpQ4vus= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sartura.hr; spf=pass smtp.mailfrom=sartura.hr; dkim=pass (2048-bit key) header.d=sartura.hr header.i=@sartura.hr header.b=mjlQTbN4; arc=pass smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sartura.hr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sartura.hr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sartura.hr header.i=@sartura.hr header.b="mjlQTbN4" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-64b9cb94ff5so5871156a12.2 for ; Mon, 26 Jan 2026 01:12:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769418766; cv=none; d=google.com; s=arc-20240605; b=PcS97L7kFxEAV8I71ZdVywdFG3bq4KNCjQzQBZ6ZOPcJqzU68sMFPWgNx3CWxHWx0R o92MKDiVT47rLuRRK2/9SlJfgowZ2Ly5gyeSlrkbgb+hNFCGgJV7ZaR1oML9gH3FuqM8 rN1GhGPYVb7myxJFumF+NMCsfU4pecbd0NKhdl1b7nFzlZjkE6Acyok7+3Bjylgix3TQ PC7puXdcyZrK38djpA6vaSFFLD6D6vmGOR+kniS6CmmEbkPAyx4nDtxwmiW27bT5XqqP 4mVsTGOctWtIyrnfG9/893betuDwT0lqhCQrBEcZ0R2v7R8h+3adZMj+6V74lr9uN8YX 2ZDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OZ0wRjpBkARHUdg5AXc4jIF+w1YP8Cq41/gPWjBo+gg=; fh=VhNnP3v6rkhYOAo0pvpgqJnBvVOIZkwHVL2qDWLq5k0=; b=F3nP4YuO+dNE4twHwY74lU6CqO9JeQqy79ZeGZzwVPGR7SnrSt4CP3J8PG1MvBzQC8 URWVYyIKpePaP8PQgd+o0VVgjl1qEZ9DRCQv7WCUotqY2DbObdPwKDs58jGQeRInHdoG vGWoSniN9YFzmkoP+8wkZKhRzhKJN1NMK6C3rx/MfeiF7UM8auKHUFXcQ1Y7RbsF7y7h GPr4gmyz0Ryofto1g0AzwPO6VEsF0w16nHtprhOm3Gspbq5hg9/jHXn9LIOZwRkHZvW2 MaUCsy26y2+AR1gz0y/HYycP5XBXPQxs3BYbECg3TU/AXCd8Z/nIDR480HmHuQa5qdd4 /gQw==; 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=sartura.hr; s=sartura; t=1769418766; x=1770023566; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=OZ0wRjpBkARHUdg5AXc4jIF+w1YP8Cq41/gPWjBo+gg=; b=mjlQTbN40meuUe7Qt2JMVdQRsK+Q1McY4Pk1gDmAJ+WYzV97KyhGD+HNG2S5wJ3+ze DGoqJtI4sOiZ2Pb/ax1Kyso6sxqoVRhGuBA9vYSEmyNJudhCApzGKVUqzJcJhCiT+U/X wG8EluaJZL0gqkUubo9cbQHcK6xBgaqdu717Mr6rd1jzMQ8ifia959ctMieyRAJfNuN/ 9AjElWOD2WzHILJuhX6gB4qnA0lJqUjvC0YwBFkZXepFwpEIgh/x0HrMQhd3BpBqOrbJ ZKRacWObla8cWS7Lf3jIBzrIFTOYIZ/Pxf65bzPn+5HGwBSGygFNW6S/2F92j1hfYmdC 9imw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769418766; x=1770023566; h=content-transfer-encoding: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; bh=OZ0wRjpBkARHUdg5AXc4jIF+w1YP8Cq41/gPWjBo+gg=; b=VP8XAK0c/OPLX0qwkK7INJPmQk9ZRbWdJPjri35BJPDDWiVRagQmMJEMj5tGzYIJEz 2gm6/U3jnyHBAMAuV26WpXDv2fIRw6heMR6imBi4q9s/uBXNEFXZrgFdzd7BgKhXRrED yOXXq4tHa4DxPRjkiahlR3oyM4O8BovMRHaCo6564OHr0xmaA1ER1UOgLt6gqozZIWUH BOQZ38kkdnMCCZseNfx1CJ1HYcRQSMotJbK9LZdo7GbKQTmG9gnm8phWKgTxgTQeMYau Gw0IuhCSay+i0IP5CCdBaI22FQinCz8XJ9u1fTdROG3TXbBlLQM2BMYE/Ghb5J0pPToP zxJw== X-Forwarded-Encrypted: i=1; AJvYcCUN9INuFmilS44fnDmC1WfO16F5EslLvvQ6mxWS2iUmgT4DikTGnMoFpkuTPVKtZtDG3Vtp8kj/LQIf/lI=@vger.kernel.org X-Gm-Message-State: AOJu0YzPSOmSHLmOeasihu/FIGFv1k7xb6D33qPARZF/fKPdxEyjEsz4 2lbfIsiR3pJ22bM7C1uzjwBz8DAzgVA2ncLvlk9ag/0SpQlyya+EDD3j1z1EfRmDGXMYP+FPbNH b/IQBscjfMLTKtEPjbRQFwj5mZ1vnwsdpPvJljBxvVQ== X-Gm-Gg: AZuq6aK8HXgBbfLHaWFoa2+XNmqLI2p0LiI45PBvi+a7OXiXUkrikZLGc8g53xXD/Aj G65Hmq3n627LCl4cUgEWDYUPbyGAiQg9TsyR+dGS6HuD8lYTQtKDBJq5Fl+ukYUOHg00x37+WxE IaUA980zx2KXj3HCC5AMUXzKZKndLZRckXAPG/QbORTEvWCjkHNuS/whLJNTJu8G9Ae9mqCf9LS gFO0boM8/ZtWGa/CE3bv7dZBaimcI+7GsQICtRAWZYpPSGBxQSG4rtTF2JjoZK/PArvQzoQF7AU Tg5p26cCHTjrOHImPRo5vfsxyKdDm/3fX4hh456m4YVg29K8y5U= X-Received: by 2002:a05:6402:4508:b0:64c:fc09:c956 with SMTP id 4fb4d7f45d1cf-658706d59cfmr1542296a12.29.1769418766039; Mon, 26 Jan 2026 01:12:46 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250827-i2c-pxa-fix-i2c-communication-v3-0-052c9b1966a2@gmail.com> <20250827-i2c-pxa-fix-i2c-communication-v3-1-052c9b1966a2@gmail.com> In-Reply-To: <20250827-i2c-pxa-fix-i2c-communication-v3-1-052c9b1966a2@gmail.com> From: Robert Marko Date: Mon, 26 Jan 2026 10:12:35 +0100 X-Gm-Features: AZwV_QjHvCNM4XDV7ASy_DsR-MKQkm_PDnKvDdBjq4JrCqpz7uMbU7Pm9e77hpI Message-ID: Subject: Re: [PATCH v3 1/2] i2c: pxa: defer reset on Armada 3700 when recovery is used To: Gabor Juhos Cc: Wolfram Sang , Wolfram Sang , Andi Shyti , Andy Shevchenko , Russell King , Andrew Lunn , Hanna Hawa , Linus Walleij , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Aug 27, 2025 at 7:14=E2=80=AFPM Gabor Juhos wrot= e: > > The I2C communication is completely broken on the Armada 3700 platform > since commit 0b01392c18b9 ("i2c: pxa: move to generic GPIO recovery"). > > For example, on the Methode uDPU board, probing of the two onboard > temperature sensors fails ... > > [ 7.271713] i2c i2c-0: using pinctrl states for GPIO recovery > [ 7.277503] i2c i2c-0: PXA I2C adapter > [ 7.282199] i2c i2c-1: using pinctrl states for GPIO recovery > [ 7.288241] i2c i2c-1: PXA I2C adapter > [ 7.292947] sfp sfp-eth1: Host maximum power 3.0W > [ 7.299614] sfp sfp-eth0: Host maximum power 3.0W > [ 7.308178] lm75 1-0048: supply vs not found, using dummy regulator > [ 32.489631] lm75 1-0048: probe with driver lm75 failed with error -1= 21 > [ 32.496833] lm75 1-0049: supply vs not found, using dummy regulator > [ 82.890614] lm75 1-0049: probe with driver lm75 failed with error -1= 21 > > ... and accessing the plugged-in SFP modules also does not work: > > [ 511.298537] sfp sfp-eth1: please wait, module slow to respond > [ 536.488530] sfp sfp-eth0: please wait, module slow to respond > ... > [ 1065.688536] sfp sfp-eth1: failed to read EEPROM: -EREMOTEIO > [ 1090.888532] sfp sfp-eth0: failed to read EEPROM: -EREMOTEIO > > After a discussion [1], there was an attempt to fix the problem by > reverting the offending change by commit 7b211c767121 ("Revert "i2c: > pxa: move to generic GPIO recovery""), but that only helped to fix > the issue in the 6.1.y stable tree. The reason behind the partial succes > is that there was another change in commit 20cb3fce4d60 ("i2c: Set i2c > pinctrl recovery info from it's device pinctrl") in the 6.3-rc1 cycle > which broke things further. > > The cause of the problem is the same in case of both offending commits > mentioned above. Namely, the I2C core code changes the pinctrl state to > GPIO while running the recovery initialization code. Although the PXA > specific initialization also does this, but the key difference is that > it happens before the controller is getting enabled in i2c_pxa_reset(), > whereas in the case of the generic initialization it happens after that. > > Change the code to reset the controller only before the first transfer > instead of before registering the controller. This ensures that the > controller is not enabled at the time when the generic recovery code > performs the pinctrl state changes, thus avoids the problem described > above. > > As the result this change restores the original behaviour, which in > turn makes the I2C communication to work again as it can be seen from > the following log: > > [ 7.363250] i2c i2c-0: using pinctrl states for GPIO recovery > [ 7.369041] i2c i2c-0: PXA I2C adapter > [ 7.373673] i2c i2c-1: using pinctrl states for GPIO recovery > [ 7.379742] i2c i2c-1: PXA I2C adapter > [ 7.384506] sfp sfp-eth1: Host maximum power 3.0W > [ 7.393013] sfp sfp-eth0: Host maximum power 3.0W > [ 7.399266] lm75 1-0048: supply vs not found, using dummy regulator > [ 7.407257] hwmon hwmon0: temp1_input not attached to any thermal zo= ne > [ 7.413863] lm75 1-0048: hwmon0: sensor 'tmp75c' > [ 7.418746] lm75 1-0049: supply vs not found, using dummy regulator > [ 7.426371] hwmon hwmon1: temp1_input not attached to any thermal zo= ne > [ 7.432972] lm75 1-0049: hwmon1: sensor 'tmp75c' > [ 7.755092] sfp sfp-eth1: module MENTECHOPTO POS22-LDCC-KR r= ev 1.0 sn MNC208U90009 dc 200828 > [ 7.764997] mvneta d0040000.ethernet eth1: unsupported SFP module: n= o common interface modes > [ 7.785362] sfp sfp-eth0: module Mikrotik S-RJ01 r= ev 1.0 sn 61B103C55C58 dc 201022 > [ 7.803426] hwmon hwmon2: temp1_input not attached to any thermal zo= ne > > Link: https://lore.kernel.org/r/20230926160255.330417-1-robert.marko@sart= ura.hr #1 > > Cc: stable@vger.kernel.org # 6.3+ > Fixes: 20cb3fce4d60 ("i2c: Set i2c pinctrl recovery info from it's device= pinctrl") > Signed-off-by: Gabor Juhos > --- Tested-by: Robert Marko > Changes in v3: > - rebase on tip of i2c/for-current > - rework the patch and use a different approach which does not requires > modification in the I2C core code and update commit description > acccordingly > - remove Imre's SoB tag, it should have been a Reviewed-by tag, but due > to the rework this is an entirely different patch so that does not > apply anyway > - use Link tag for the URL of the referenced LKML thread > - Link to v2: https://lore.kernel.org/r/20250811-i2c-pxa-fix-i2c-commun= ication-v2-2-ca42ea818dc9@gmail.com > > Changes in v2: > - rebase and retest on tip of i2c/for-current > - Link to v1: https://lore.kernel.org/r/20250511-i2c-pxa-fix-i2c-commun= ication-v1-2-e9097d09a015@gmail.com > --- > drivers/i2c/busses/i2c-pxa.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c > index 968a8b8794dac3398a68d827c567aa5bb73ae3d7..70acf33e1d573231f84a1f09c= ffb376a8277351d 100644 > --- a/drivers/i2c/busses/i2c-pxa.c > +++ b/drivers/i2c/busses/i2c-pxa.c > @@ -268,6 +268,7 @@ struct pxa_i2c { > struct pinctrl *pinctrl; > struct pinctrl_state *pinctrl_default; > struct pinctrl_state *pinctrl_recovery; > + bool reset_before_xfer; > }; > > #define _IBMR(i2c) ((i2c)->reg_ibmr) > @@ -1144,6 +1145,11 @@ static int i2c_pxa_xfer(struct i2c_adapter *adap, > { > struct pxa_i2c *i2c =3D adap->algo_data; > > + if (i2c->reset_before_xfer) { > + i2c_pxa_reset(i2c); > + i2c->reset_before_xfer =3D false; > + } > + > return i2c_pxa_internal_xfer(i2c, msgs, num, i2c_pxa_do_xfer); > } > > @@ -1521,7 +1527,16 @@ static int i2c_pxa_probe(struct platform_device *d= ev) > } > } > > - i2c_pxa_reset(i2c); > + /* > + * Skip reset on Armada 3700 when recovery is used to avoid > + * controller hang due to the pinctrl state changes done by > + * the generic recovery initialization code. The reset will > + * be performed later, prior to the first transfer. > + */ > + if (i2c_type =3D=3D REGS_A3700 && i2c->adap.bus_recovery_info) > + i2c->reset_before_xfer =3D true; > + else > + i2c_pxa_reset(i2c); > > ret =3D i2c_add_numbered_adapter(&i2c->adap); > if (ret < 0) > > -- > 2.50.1 > --=20 Robert Marko Staff Embedded Linux Engineer Sartura d.d. Lendavska ulica 16a 10000 Zagreb, Croatia Email: robert.marko@sartura.hr Web: www.sartura.hr