From nobody Fri Feb 13 08:06:45 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51029E82CA5 for ; Wed, 27 Sep 2023 15:50:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232795AbjI0Pup (ORCPT ); Wed, 27 Sep 2023 11:50:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232772AbjI0Pu0 (ORCPT ); Wed, 27 Sep 2023 11:50:26 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D3E0D036 for ; Wed, 27 Sep 2023 08:42:51 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-690b7cb71aeso8719228b3a.0 for ; Wed, 27 Sep 2023 08:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1695829370; x=1696434170; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=e+KczYJ63iTfnuMsHD4IMClJxOV5m4dNcMyA1mqDD9g=; b=RLhwbE5cF0AchcrKRjBTtVBNA2oVXu2QTVVh6MJ9Ue4WgkSdIkayZ6YTp2NI5dr2G8 Ozy2UO4I8rx3jZdn+ycpNbQ7rewp4IBrVrEMHneNdjbMi2hxhqyhrbK5Ehf3AwWwZYQW Sqv4TL1DIhUcNfGnxYBIxRfkXimpF8nQX+i7wOUWZ8h4/vhkLGoH1EqQZ2qa3fgLh9rS Z34lIsCHRNLOFEJ5MtSXRBBU6EwP45inYMrrQyowlhXjkVWTJ5xllTZGvOualR3eqTte lrm6a8uiXM6SmqR632zFc+hHyImYQ0bXojujQCy40bLTacK3/24fcmVyXyeyyF4GA7bB N8xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695829370; x=1696434170; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=e+KczYJ63iTfnuMsHD4IMClJxOV5m4dNcMyA1mqDD9g=; b=K+eHP+9XNRcodbOUX327+KEWzlrgjCQTsFY/IgYauvyNa7JTWxmFvirvU6r5NrfJ/G SPCQ1l7FanLTdx1MLzuQvCwKMKHnZ+6ziI7iMdgl8aVd2/xSw08zGnnSxXqwD/S6Z0Zy 0jK/fM7jhNj/PenuWvXVdaF+lfBuGDjwUVBeLsorVAubkHJnyV9kkgskL1x+EkTzM04t NFRV/wF3vlIQEQWl4XBBT4Xk3UWwLwaye0RfSYzFD57vSOOVCmHxamiwiQkXBjaH88f1 kFYdFugSjz5mZ8ocuPvQkzykSdwwFWQGOYarbjomJyg8K1cLS4u/d2QoWFPk7fjoSVKb HsXw== X-Gm-Message-State: AOJu0YwXeMoeXu4NdwyY/dOHkGqYf6LoExUBlPwW81MjBd24l9jQPYdM diI2ReSXKHWxzzUl9UylMI+fuA== X-Google-Smtp-Source: AGHT+IFRfQ/0KX1bSuu5UuM2JxSiQwHD4x642i16XMLdBILDBkTo7GJS+ledc4uHjgaqOgLCqUIbcg== X-Received: by 2002:a05:6a21:9983:b0:15d:1646:285a with SMTP id ve3-20020a056a21998300b0015d1646285amr3860484pzb.21.1695829370365; Wed, 27 Sep 2023 08:42:50 -0700 (PDT) Received: from localhost ([49.7.199.230]) by smtp.gmail.com with ESMTPSA id v3-20020a655c43000000b005782ad723casm10120152pgr.27.2023.09.27.08.42.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 08:42:50 -0700 (PDT) From: Jian Zhang To: brendan.higgins@linux.dev, benh@kernel.crashing.org, joel@jms.id.au, andrew@aj.id.au Cc: zhangjian3032@gmail.com, yulei.sh@bytedance.com, xiexinnan@bytedance.com, Andi Shyti , Tommy Huang , Wolfram Sang , linux-i2c@vger.kernel.org (open list:ARM/ASPEED I2C DRIVER), openbmc@lists.ozlabs.org (moderated list:ARM/ASPEED I2C DRIVER), linux-arm-kernel@lists.infradead.org (moderated list:ARM/ASPEED MACHINE SUPPORT), linux-aspeed@lists.ozlabs.org (moderated list:ARM/ASPEED MACHINE SUPPORT), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2] i2c: aspeed: Fix i2c bus hang in slave read Date: Wed, 27 Sep 2023 23:42:43 +0800 Message-Id: <20230927154244.3774670-1-zhangjian.3032@bytedance.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" When the `CONFIG_I2C_SLAVE` option is enabled and the device operates as a slave, a situation arises where the master sends a START signal without the accompanying STOP signal. This action results in a persistent I2C bus timeout. The core issue stems from the fact that the i2c controller remains in a slave read state without a timeout mechanism. As a consequence, the bus perpetually experiences timeouts. In this case, the i2c bus will be reset, but the slave_state reset is missing. Fixes: fee465150b45 ("i2c: aspeed: Reset the i2c controller when timeout oc= curs") Signed-off-by: Jian Zhang Acked-by: Andi Shyti =20 Reviewed-by: Andrew Jeffery Tested-by: Andrew Jeffery --- drivers/i2c/busses/i2c-aspeed.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspee= d.c index 5a416b39b818..18f618625472 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -933,6 +933,7 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, /* If slave has already been registered, re-enable it. */ if (bus->slave) __aspeed_i2c_reg_slave(bus, bus->slave->addr); + bus->slave_state =3D ASPEED_I2C_SLAVE_INACTIVE; #endif /* CONFIG_I2C_SLAVE */ /* Set interrupt generation of I2C controller */ -- 2.30.2