Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1458345lqt; Fri, 7 Jun 2024 21:42:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWLHk1vnNLHKUgHWQG0pUwkzcr8NfdwKz9og1WEJNTt2MSU0wuPG4AjZicpt3p7Nzc28MpZJX6s1K/u5UDQVsy7e/LocoNKZhLtr2c3VQ== X-Google-Smtp-Source: AGHT+IEmNhdRWED9pIsuM9/WciPB8DcK90dBhsnrcx04uwcqf24w0PRUtxKTO6ul0aI8Pxekri7L X-Received: by 2002:a17:903:2346:b0:1f6:7d0c:e932 with SMTP id d9443c01a7336-1f6d02f471emr49041575ad.34.1717821748267; Fri, 07 Jun 2024 21:42:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717821748; cv=pass; d=google.com; s=arc-20160816; b=I2Mqn9GSnAWrl5AAceg81HgWKIfOlkmxUjMhzXohuiwdtxWmVq8l/fCqAz6j6k13kq 44D7/TL5Fw4PI6tLg1RQ4aKcdwcmrWqZJgGpRc97OaxUlnu+utFE37UxkXqJPQe7F+sG BG4oDPtIxbR3r+snZ8ZYWO/dA2IgSOCoPYWYB1nDlVuuXaGIVYJkErYraRyBdaobwnSL epU3qFVo0DgDUmvhbVainiN+sjNZhouFJxvs30GPMV4TNFOiv8rUqExE9xv0z3Ay6Gl2 u6+XeVLCP/6P0twn39bA6ElNIMRFQqMiOQXqmOGTRcgM7yc1FEAyvqeCGVg8wVTwMQWW mDiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=5oBwUqfRUZfhjUWaVTq9XONgIOSX6IXNjTX27aebpaM=; fh=ZN4scanOU3RLl3MW4YUdJYUPXIsxR+2EElnDZ7rok/I=; b=AmZgP7awRHgbxE9ivJqxzSTktaaZZl92MTYVfDVjJQWvHA+j8KNMPW8paLmEyjN+os +dRhTIm8B8ZeuBJoPbDNWk42HjgsKP3l7ngoDFSha3OiDYX35khXfsvZ/p9Cqt43Qbgr 48Muu2I6Wvf9+RHWE/gbvmirWrS3amSBUiPbaAohNYABj7Br9Jonlj7NI08F9EVKYbMn bBn0Fk9mgnuhoJO9qbXmm9Mr9JWUtMf6qDwCNQCE0ihzo0X+FTzx92WLUpzGZeEqMArC 6kH8uDSTL0gMdujmFNXA7FtMeZrE0cM00DybYKTZzS8g5kfyx4GFWqgEy6gsP88oVCIC ssUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aspeedtech.com dmarc=pass fromdomain=aspeedtech.com); spf=pass (google.com: domain of linux-kernel+bounces-206905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=aspeedtech.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7e400dsi42199555ad.358.2024.06.07.21.42.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 21:42:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aspeedtech.com dmarc=pass fromdomain=aspeedtech.com); spf=pass (google.com: domain of linux-kernel+bounces-206905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=aspeedtech.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DD016283C43 for ; Sat, 8 Jun 2024 04:42:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 099CC134B1; Sat, 8 Jun 2024 04:42:19 +0000 (UTC) Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (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 9E516FC01; Sat, 8 Jun 2024 04:42:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717821738; cv=none; b=fqvomZYHmlEU1LYBcR6bhB5nRmCMT71fW7KD5W78NT+QQSsOW5D1OKHTHfty1d9zWg7rY0h3XOfzDpdzPJM1WIMD3mj/9DkooCo/UaqeCToZMLfc6tqEm1lZDQtUjdMJv3faUvkMwiGX1XmoEH4Qmqv1wU2N8H10JcNrmBj3a2Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717821738; c=relaxed/simple; bh=aZNIDronOWOXmDWaTQFeyQ04nj2HQc3TXTZHwnR/AXQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=pMqkTmqzsAyp+boPKqP+hVoBnAih0n4S6nYmFXXdefrOcPWXvcfpinVJ65hGqTLLBrEMz0ScER61ZwvujtW5lp4Nz+qqKlYL2rURySt0QVI2ZFWDEoLA5gEQGoUfruKN12+Mqht9fvuf+ZjVOh6TU5kaR9h06UaKl2rZaZuMO88= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX02.aspeed.com (192.168.0.24) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Sat, 8 Jun 2024 12:36:54 +0800 Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX02.aspeed.com (192.168.0.25) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 8 Jun 2024 12:36:54 +0800 Received: from twmbx02.aspeed.com (192.168.10.10) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1258.12 via Frontend Transport; Sat, 8 Jun 2024 12:36:53 +0800 From: Tommy Huang To: , , , , , CC: , , , , , , Subject: [PATCH v2] i2c: aspeed: Update the stop sw state when the bus recovery occurs Date: Sat, 8 Jun 2024 12:36:53 +0800 Message-ID: <20240608043653.4086647-1-tommy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Received-SPF: Fail (TWMBX02.aspeed.com: domain of tommy_huang@aspeedtech.com does not designate 192.168.10.10 as permitted sender) receiver=TWMBX02.aspeed.com; client-ip=192.168.10.10; helo=twmbx02.aspeed.com; When the i2c bus recovery occurs, driver will send i2c stop command in the scl low condition. In this case the sw state will still keep original situation. Under multi-master usage, i2c bus recovery will be called when i2c transfer timeout occurs. Update the stop command calling with aspeed_i2c_do_stop function to update master_state. Fixes: f327c686d3ba ("i2c: aspeed: added driver for Aspeed I2C") Cc: # v4.13+ Signed-off-by: Tommy Huang --- drivers/i2c/busses/i2c-aspeed.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index ce8c4846b7fa..be64e419adf0 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -25,6 +25,8 @@ #include #include +static void aspeed_i2c_do_stop(struct aspeed_i2c_bus *bus); + /* I2C Register */ #define ASPEED_I2C_FUN_CTRL_REG 0x00 #define ASPEED_I2C_AC_TIMING_REG1 0x04 @@ -187,7 +189,7 @@ static int aspeed_i2c_recover_bus(struct aspeed_i2c_bus *bus) command); reinit_completion(&bus->cmd_complete); - writel(ASPEED_I2CD_M_STOP_CMD, bus->base + ASPEED_I2C_CMD_REG); + aspeed_i2c_do_stop(bus); spin_unlock_irqrestore(&bus->lock, flags); time_left = wait_for_completion_timeout( -- 2.25.1