Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1119345lqb; Thu, 30 May 2024 00:12:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV6xEoWeFYG129oOf5KI5AUCIYqkd0M0noL1jI1IHzsj89SlHohdE5IaEtz++ZKiWTfG+13hFhUQgRVTO/wsAwQfd6ig6xlUxa805BM7w== X-Google-Smtp-Source: AGHT+IFXqgJLXhwISKgSW5O7V7zMzTNYgpuO3yXttfqmUzG5CUJajWsqJWKlTr6rSGAAUpQqSURe X-Received: by 2002:a05:6a21:3386:b0:1af:fbab:cfba with SMTP id adf61e73a8af0-1b26456fff9mr1420127637.27.1717053137307; Thu, 30 May 2024 00:12:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717053137; cv=pass; d=google.com; s=arc-20160816; b=AeP5ammJOin5JS1N1JJXGHhJ+bQZoQswVSx2SW5k9mZel8l0c5A68fYlhrkHdFfjYP GC0d2x/749+/R7Sc/1z3e89ex3oayqYrVFSUM9ZyUQRhGSUm4bu7YaladrLFnKjiLEwZ 7gz/NH+OmR8nWpj3kxidPGo7kbp3Y2beLs7g5cB5oq2be+f4ablAiyfWrw9v4x3SiBkv uRKYwsSsIfFd47eNJ2C/dSTwCQPA4q0TntcRBC56hypOHRqpOzUlh+7NsGoAdqInTHI2 y72etruwLjBXwlxFkconAkA9tV0D8nSRxW/587ueNAjiri7PmFhmbyK+RNYYXVDc4lNB AgGQ== 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=51n+4iTyDGHFbVPyJGltSUqmoKDNwsHhCwUoEXy4myc=; fh=s8ejB8OgOwVxsUgELK0hAVMFWN7BVceB2Aw3Wq3Q1nI=; b=wpazV6dL97ksH35rBvgdkJCzwuJCyYqt3y3fQkoJOLwHZgwG7aY7LymP2Kow8ph52x 806nAj0KazbGfVSg8RtNff0sBNBVw7eWPzRZiTuMTggn3ZvDwvIE9Cm8RmhUb/yjDw/K 6JEpUYnm7xOk3l1m2ohWDY+/ACMqr7eq/dCVGJ5jgGmsDXQEMvBEsuA1t+c/LmbPBPdJ srHPileSegmwT27pNiQ62ECIPhKh3/pCJzrIBrxqpovxjyX0B6MrOf5kGxlnAV5QoClQ AQyDo19rtjOiA3UZGY3E9AYnJni1W1yIGYTtchHj8TqDP28nWi0GuM/Gn3dl3s/xIRDg jA/Q==; 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-194996-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194996-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 41be03b00d2f7-6822a98e50csi12147681a12.749.2024.05.30.00.12.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 00:12:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194996-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-194996-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194996-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 600322834B2 for ; Thu, 30 May 2024 07:12:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 89EA74D8BA; Thu, 30 May 2024 07:12:09 +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 4866E4D8A6; Thu, 30 May 2024 07:12:06 +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=1717053129; cv=none; b=DusNy3BV3h/MsBifcerSUoVuI2goFJAbP1Rqk7D9lTxlgBAqWszCQerlvJO9wOWCrIx/Un4ELQLWz17APaFcsIMzjXbonp0s+L6c9jGXAhsvxS1zKVI8opw8sjpq0KCXvPy52mIFiKo8ZJqKG4MQfJCceVBilgQEwrIknhTGdP8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717053129; c=relaxed/simple; bh=A8QA5xiuTXpYm2b3qlN0XfhdUwCEKH7elZsg/fbQ2VY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=q66nGvZE5Es2hgPW5uuI5dEgeWa0jFHvppYMsFaEUbCMRgKHm66u3aiU/SIwsQcyj5OOTmOIpgqdiVY77AQlzuOdG56L+ZMadqs+Y9jjJKMybg6Thzlbg4mftlltCV8FqtXRaH1NB4229kxQpMEsiJpZnu09vVTBBzBMYDYTLmA= 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 TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Thu, 30 May 2024 15:06:56 +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; Thu, 30 May 2024 15:06:56 +0800 From: Tommy Huang To: , , , , , CC: , , , , , Subject: [PATCH] i2c: aspeed: Update the stop sw state when the bus recovry occurs Date: Thu, 30 May 2024 15:06:56 +0800 Message-ID: <20240530070656.3841066-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 When the i2c bus recovey 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") Signed-off-by: Tommy Huang --- drivers/i2c/busses/i2c-aspeed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index ce8c4846b7fa..32f8b0c1c174 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -169,6 +169,7 @@ struct aspeed_i2c_bus { }; static int aspeed_i2c_reset(struct aspeed_i2c_bus *bus); +static void aspeed_i2c_do_stop(struct aspeed_i2c_bus *bus); static int aspeed_i2c_recover_bus(struct aspeed_i2c_bus *bus) { @@ -187,7 +188,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