Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp570266lqr; Wed, 5 Jun 2024 14:28:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNI+YHWTDzDnVFV4jVtCfR+FFh5bMZSQDuDKTHOcLh+8kihPPBPNq/5aP7tNiScgqE0EsQjOJXzpK9PIa/w0Qpk7K37McJON3thFXf3Q== X-Google-Smtp-Source: AGHT+IG2l6iYq3skLkz7rr4fKn9DzrhDCkLd1TGHdK4VE/dVeaQrMYBlqAYlO7yX3LLcyORfC3l4 X-Received: by 2002:a2e:9154:0:b0:2e0:da20:2502 with SMTP id 38308e7fff4ca-2eac7a8029dmr26614371fa.49.1717622908252; Wed, 05 Jun 2024 14:28:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717622908; cv=pass; d=google.com; s=arc-20160816; b=D9xcRM0uet/E5y49GsQCCaHZgA4920deiV84vyQgfEElM2VSeTV0dV5Bs8WQezE//6 rUpx/ZJJZh0fy82ZpVB5PHv/J7eQUXNKe8GCLniuU/JksmNMbtG8eVUrVuRbH4zWOPrS WZIZf8RwYkegKboG8/WEhwdK9JhDSV0ED8H1QPSa5Az1oha8ztFXnHtIudxB1PE+DLzt pia87azx5v0ZKyqwPpl+F15CmtqPBCAmURqQpTMRQgXxfAeiJOm1f3GMDO/Ow7pU2YPx ELHCy28OLUcjSw0YcO9kpq2hHnBO4xKNWR/bYlbVle2soTEdeAMccoe50IfiVZTx0bIH AExg== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tzPFGbo6X3zcNdVJFT3Zq8NM38ZKt/TD8N6qjoX5nmY=; fh=F5i+rNW4hjf57QJHDx14Nq4Eso4Z4OyY/LhC2i40VT4=; b=G7Fbii39KNwD4aYlRsT2dITeSsmqUbnBw1DkL1mqeKKXn9gtjTT5ffrFKCviOzvJ0C KAKxblpWi8UIz40mPEG2/ZbtVX7gFG6MqxIeshL5N2OGc5jFlsa6Uu0EShAfz2GgG8LG V9yx9MMerEW3RBqZsF23nYofUACKCCVwnQ5Dqlg4YUBK+diS6aMjBti8nHSuOOsLjfMg XhDLT86TLdYFJ4C5QkDLiFndZ+z06IRdbFYirHcJXZ2FznXDIAPLhjHi11Z/FxYZRs8s G8hczHLbFANo2I8uYI8gOuaPD2ozGX6fAhbuJCXCVwBN0r0XARi3kNx/xJAZ/+q7PKEL twsQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LFmwXbUk; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-203269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203269-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31caf375si6356490a12.601.2024.06.05.14.28.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:28:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LFmwXbUk; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-203269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203269-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7A78A1F23AFF for ; Wed, 5 Jun 2024 21:27:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 255AA17FACB; Wed, 5 Jun 2024 21:23:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="LFmwXbUk" 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CF49161338; Wed, 5 Jun 2024 21:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717622622; cv=none; b=Ynv4LqAGMSLsfaYz3p0jKjXkZVUG80X2mh97LRQawVCg53klmFRJ2A/7N8nOCRfthxTP0aYvmHcxxEJ9H5Ufq7nte61yRAgIET5TtBf6OBu3HRAEHla9IugVrLWYyKz00XFFBSwe8otFMdCCjlFzfbZRG+fEHya48nMziYYcSvw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717622622; c=relaxed/simple; bh=X1ZPTS2YGQm53cxlgKYe1PLkwaNISkZBsXhdru69tw0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FfrUbYHHg3822nS3bQrQMCnujx2AeUXPYi5YQoVf4frbxMOEOTnS1C9Q/jjsrgTgkwHIdlHgWtqPh47uNC6gRLf/XEjzIFaIVUqFJEACEG3j8tObcmB1U0eiVGNcAB6pJKxG29O0+UKsCT+12uqkg+4Xi2juvX0wmuIZW7rNIiU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=LFmwXbUk; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 455L0M6C020105; Wed, 5 Jun 2024 21:23:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pp1; bh=tzPFGbo6X3zcNdVJFT3Zq8NM38ZKt/TD8N6qjoX5nmY=; b=LFmwXbUkLDUlqMUbh43BLVJmYJwm3u95qeXYHqRRrIyklKO3Q3Dy29ZWBaX/WP1Nx842 6OC/TFd9N0t8dQT0OH3wx5FDB428MgnQEIMk7z1kKuL202EMW7bG/kXmJa3/a3M0UsJe W8M3o8mcUUbk9GjmxVDuPUbXZMFfmYPoChhQqEAfP8cDWEhEHpzElNWkjEkX39YGaXeU BjeTQpPFpblLOFvFJN34xEgL4iH2baUtJWJOznXr50geBvWrq0zv2nJZjRAB17JIxCZz /jMUpUZzInQ+gCkhibXU0/mgx9lcYw9wmyYXdw96PWdmF3Zx1XaqiDIUGpXR4fxMPv4P 0A== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yjyhyr1n0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Jun 2024 21:23:26 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 455LKarG026550; Wed, 5 Jun 2024 21:23:25 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yggp366fn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Jun 2024 21:23:25 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 455LNMSL62390660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Jun 2024 21:23:24 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE5FB58059; Wed, 5 Jun 2024 21:23:22 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 70E2958063; Wed, 5 Jun 2024 21:23:22 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.121.242]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Jun 2024 21:23:22 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: eajames@linux.ibm.com, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org, broonie@kernel.org, andi.shyti@kernel.org, joel@jms.id.au, alistair@popple.id.au, jk@ozlabs.org, andrew@codeconstruct.com.au, linux-aspeed@lists.ozlabs.org, ninad@linux.ibm.com, lakshmiy@us.ibm.com Subject: [PATCH v4 31/40] i2c: fsi: Add boolean for skip stop command on abort Date: Wed, 5 Jun 2024 16:23:03 -0500 Message-Id: <20240605212312.349188-32-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240605212312.349188-1-eajames@linux.ibm.com> References: <20240605212312.349188-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: yW79Vq_Nf2d9DiF3iPLrnYOgWUy5xVNM X-Proofpoint-GUID: yW79Vq_Nf2d9DiF3iPLrnYOgWUy5xVNM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-05_02,2024-06-05_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 mlxscore=0 suspectscore=0 malwarescore=0 impostorscore=0 phishscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406050160 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 022f1287aa0e3..614d830419bb8 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; -- 2.39.3