From patchwork Mon Feb 26 16:53:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 1904515 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=bNogvbta; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linux-fsi-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tk6CH4nTRz23cb for ; Tue, 27 Feb 2024 03:54:03 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=bNogvbta; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Tk6CH36BSz3vdk for ; Tue, 27 Feb 2024 03:54:03 +1100 (AEDT) X-Original-To: linux-fsi@lists.ozlabs.org Delivered-To: linux-fsi@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=bNogvbta; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=eajames@linux.ibm.com; receiver=lists.ozlabs.org) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Tk6C85nh2z3dhk for ; Tue, 27 Feb 2024 03:53:56 +1100 (AEDT) Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41QG12KX018630; Mon, 26 Feb 2024 16:53:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=jHq/vBDBbZBSuhSZdVDjxpYwsAaHsSkR8YTxz+PKabo=; b=bNogvbtaSA5C+ilSm/CEZHEW6K4gJdQQcdVBLJuP1jYpYCU6gsh17yWs7cXC8vw8Rkk1 pRv8EW0IwA8VWfYC/zQgshUNkwUx2sX43OUiDv+mnm5qDwawY7DBjPu1AYfSKlvK+TIO 5TxqtP6gWrlNHpRc4pvQLZxFoqmKnIfs5yVk9HsHU5i7M5Dc88dtDhfkm55tOU/DJ6eq MUOfbC1rAWqfUB0na+0DmolXPxp7dHZ00HljXjEKR17ijRyXv/K7FvP33USJA6yT7vlG YTsPNA3zGfLQ5JfpNbbkASN7XdQAR2iT9+85HnKk8pLHOPLRHCpugp0SLoUaRuum8hJN wQ== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wgw0k35dk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 16:53:50 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41QGgnTt021728; Mon, 26 Feb 2024 16:53:49 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wfu5ytksd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 16:53:49 +0000 Received: from smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41QGrkUl21103192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Feb 2024 16:53:49 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA5BE58059; Mon, 26 Feb 2024 16:53:46 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2E2025805D; Mon, 26 Feb 2024 16:53:46 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.57.130]) by smtpav05.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 26 Feb 2024 16:53:46 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Subject: [PATCH v2 30/31] i2c: fsi: Add boolean for skip stop command on abort Date: Mon, 26 Feb 2024 10:53:20 -0600 Message-Id: <20240226165321.91976-31-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240226165321.91976-1-eajames@linux.ibm.com> References: <20240226165321.91976-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: XYAcP_qZUe-CGT6_iSEUR-llXo9h3YtH X-Proofpoint-ORIG-GUID: XYAcP_qZUe-CGT6_iSEUR-llXo9h3YtH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-26_11,2024-02-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402260128 X-BeenThere: linux-fsi@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, andi.shyti@kernel.org, alistair@popple.id.au, linux-kernel@vger.kernel.org, lakshmiy@us.ibmcom, linux-i2c@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org, robh@kernel.org Errors-To: linux-fsi-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "linux-fsi" In preparation for interrupt support, store whether to skip the final stop command during the abort procedure instead of checking the previously read status register in the abort function. Signed-off-by: Eddie James --- drivers/i2c/busses/i2c-fsi.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index 5f524fb6f0f8..33f4e64cb60b 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -116,6 +116,9 @@ #define I2C_STAT_ANY_RESP (I2C_STAT_ERR | \ I2C_STAT_DAT_REQ | \ I2C_STAT_CMD_COMP) +#define I2C_STAT_SKIP_STOP (I2C_STAT_PARITY | \ + I2C_STAT_LOST_ARB | \ + I2C_STAT_STOP_ERR) /* extended status register */ #define I2C_ESTAT_FIFO_SZ GENMASK(31, 24) @@ -150,6 +153,7 @@ struct fsi_i2c_master { struct mutex lock; u32 clock_div; u8 fifo_size; + bool skip_stop; }; struct fsi_i2c_port { @@ -459,31 +463,30 @@ static int fsi_i2c_reset_engine(struct fsi_i2c_master *i2c, u16 port) return 0; } -static int fsi_i2c_abort(struct fsi_i2c_port *port, u32 status) +static int fsi_i2c_abort(struct fsi_i2c_port *port) { struct fsi_i2c_master *i2c = port->master; u32 cmd = I2C_CMD_WITH_STOP; unsigned long start; - u32 stat; + u32 status; int rc; rc = fsi_i2c_reset_engine(i2c, port->port); if (rc) return rc; - rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &stat); + rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &status); if (rc) return rc; /* if sda is low, peform full bus reset */ - if (!(stat & I2C_STAT_SDA_IN)) { + if (!(status & I2C_STAT_SDA_IN)) { rc = fsi_i2c_reset_bus(i2c, port); if (rc) return rc; } - /* skip final stop command for these errors */ - if (status & (I2C_STAT_PARITY | I2C_STAT_LOST_ARB | I2C_STAT_STOP_ERR)) + if (i2c->skip_stop) return 0; /* write stop command */ @@ -534,7 +537,8 @@ static int fsi_i2c_handle_status(struct fsi_i2c_port *port, int rc; if (status & I2C_STAT_ERR) { - rc = fsi_i2c_abort(port, status); + port->master->skip_stop = status & I2C_STAT_SKIP_STOP; + rc = fsi_i2c_abort(port); if (rc) return rc;