Message ID | 20240226165321.91976-30-eajames@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-81976-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2206918dyb; Mon, 26 Feb 2024 09:02:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXoRcfHLLbEPHU52eSm3UNbtr0XkjStCbzCOlaNGImUi9YNjAam8TQVh1mVv086eWttitUK4ThVDcRJI9FDC7ga2ckqPA== X-Google-Smtp-Source: AGHT+IF4FF3BLxnA2r/rsjRF1LTvLGPpj44MPExeQhsFZ+aEKcmii4gU3XDZgQBUlBkoIDFONJUc X-Received: by 2002:ac2:5a5e:0:b0:512:d5ca:eb2f with SMTP id r30-20020ac25a5e000000b00512d5caeb2fmr4231654lfn.52.1708966977266; Mon, 26 Feb 2024 09:02:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708966977; cv=pass; d=google.com; s=arc-20160816; b=FSnTu/67eqDUYqPh+u13UJv8pMKAAHsE8Bd85+s55nXPV+FE4eaoTvfmXEtpK9f95w LGNVjnj3GNrT/tfcOgtYJF48CaPvsJFaklgM+BifphbCbXo3JoNctpxSmpYtEwpsExEo yrM16/PNM6N9wo2dUDeOZkia2dKL9JDEE5q3yXrfM/5lJrMElolq1Znj+nNiLIpSNNyL 9XDy5sumUzKAWYQgqBMtO2NRUtCpQqRzWqHIchaH0PDSHDrWsOtr6QX7/YMGadGlv5MX zEsQf/FBiBdKeNKml9NZoFEDEwAOrVJHlYzZRQMuZDK2yJsEv8ZqElruas9P9SlexncY 3C2w== 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=VTP7z+tQ2W8GOsBuCAI+ahfXY5pZN8Q0NRIJ8nxWHJo=; fh=hD87NRI2uXFKH7lntJG4G4naYHSrGp3lxTKSbIyEdj8=; b=tDRoXwpsn134bL3J3NtAGNm3WnLIr4IPebGOUEjkmyXyokDGtLVoE8LgFHTvSmXoeW TaVGmQaunFpyb4aDuPr2Tpcv0yo4e8r9jNFzvIN3JUh3+nZoY/wxt6ObAxQi4tNPchgk NzCYKKj5IUn2+a6zAfty/pb5pQtJWfrf2O/XCucsaOdczLJG15xwH94lgGrDeWYYt9vl xoJVtGU7tkCl1mECxQ+TE8XnmqmoOELak+5uOA1+mIBnkp0jMPwwXm1PrLDN8oescmKl U+BZg8hRxZnWmY8fNkJvHBPE9KCY5gRoxcLxBGZrfopeN6FbWleCZloGjjv4zsOV95BD Gndg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=VHd2tQVe; 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-81976-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81976-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p20-20020a50cd94000000b005638f3b35d9si2231391edi.297.2024.02.26.09.02.57 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 09:02:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81976-ouuuleilei=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=VHd2tQVe; 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-81976-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81976-ouuuleilei=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 AF2341F2670C for <ouuuleilei@gmail.com>; Mon, 26 Feb 2024 17:02:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D713137C28; Mon, 26 Feb 2024 16:54:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="VHd2tQVe" 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 CB10F1350EE; Mon, 26 Feb 2024 16:53:59 +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=1708966441; cv=none; b=XkUN7flB1r9Ji9rgBNkQjJoYd/ipuXbxCW8kBMJJLsOYi5mMoQi3mbQdwu2/tr75fwf/XmpvwqEOR0ZQmkPO1rFsLgLebzcoRFaXSGCdlNPaZw1c+EiDEsaJYKvGd+ytXQ07bIwOFKxRnrsMu+izgGyIM0WSww268YJsrr9r1SI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708966441; c=relaxed/simple; bh=H95OXKDiOnZPDBQirsADlzhMc6VAfrwQDtpLN9WMyRg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MqWkmjdyeKkgw/1ZpDaIKivVGhDCQSMtOAJftp95aWrxdcHHvkC9ssQRXTzuleXpnThFh2veJ+ZXEoZqpCuK4R1h+Cwl1DHQ9RWhiU1YSejHMrn3iZlhCR/2XfNQNEC1EHw6aixw9PoDWEFc69n9esKVdIQUx3t+hqTAzfPAEh4= 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=VHd2tQVe; 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 (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41QGgVRD002939; Mon, 26 Feb 2024 16:53:50 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=VTP7z+tQ2W8GOsBuCAI+ahfXY5pZN8Q0NRIJ8nxWHJo=; b=VHd2tQVebWFmLxgWk/WRZIckNa2Xel8JPZqWYe9uqWgp9QwvYj6GF9jIQlOZBFHD4If9 qQPe30agy8o1QTw8TK4LNrayP1sE3N05HDh2+fokWdlKWVDVskARnSZQPXM4wQbjz0As lJUj06yxNNm2YLqPN6Fk/sHWgcLjihgF4cNk7aitc83teC4qrGgFDummnnPR0NLb8tpx XtOEz3BztEQoWeegGcl8vawR5V3xT31cW82+5ePueDJUSutC883ryx/w9RieSy3FaFML lPvyhZ8tiGaZM0UoBdP/eQSzDRwOSR/PxOQMZd2MPlA2KSWMTrtCU0f4Q6dLUVkRCr+U 8Q== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wgxd4ga4u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 16:53:49 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41QEbsEA021259; Mon, 26 Feb 2024 16:53:48 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wfusnteen-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 16:53:48 +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 41QGrk1S63439312 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Feb 2024 16:53:48 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 187B058053; 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 5F32358043; Mon, 26 Feb 2024 16:53:45 +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:45 +0000 (GMT) From: Eddie James <eajames@linux.ibm.com> To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, lakshmiy@us.ibmcom Subject: [PATCH v2 29/31] i2c: fsi: Define a function to check status error bits Date: Mon, 26 Feb 2024 10:53:19 -0600 Message-Id: <20240226165321.91976-30-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: tszOviq8HUQ84u2AJHZSGmB61XkJ3l3f X-Proofpoint-ORIG-GUID: tszOviq8HUQ84u2AJHZSGmB61XkJ3l3f 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 adultscore=0 bulkscore=0 mlxlogscore=967 spamscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402260128 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791981757158004483 X-GMAIL-MSGID: 1791981757158004483 |
Series |
fsi: Interrupt support
|
|
Commit Message
Eddie James
Feb. 26, 2024, 4:53 p.m. UTC
This will be used more than once with interrupt support, so split
the error bit checks into a function.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/i2c/busses/i2c-fsi.c | 38 ++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index 096dc7e2369f..5f524fb6f0f8 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -507,6 +507,26 @@ static int fsi_i2c_abort(struct fsi_i2c_port *port, u32 status) return -ETIMEDOUT; } +static int fsi_i2c_error_status_to_rc(u32 status) +{ + if (status & I2C_STAT_INV_CMD) + return -EINVAL; + + if (status & (I2C_STAT_PARITY | I2C_STAT_BE_OVERRUN | I2C_STAT_BE_ACCESS)) + return -EPROTO; + + if (status & I2C_STAT_NACK) + return -ENXIO; + + if (status & I2C_STAT_LOST_ARB) + return -EAGAIN; + + if (status & I2C_STAT_STOP_ERR) + return -EBADMSG; + + return -EIO; +} + static int fsi_i2c_handle_status(struct fsi_i2c_port *port, struct i2c_msg *msg, u32 status) { @@ -518,23 +538,7 @@ static int fsi_i2c_handle_status(struct fsi_i2c_port *port, if (rc) return rc; - if (status & I2C_STAT_INV_CMD) - return -EINVAL; - - if (status & (I2C_STAT_PARITY | I2C_STAT_BE_OVERRUN | - I2C_STAT_BE_ACCESS)) - return -EPROTO; - - if (status & I2C_STAT_NACK) - return -ENXIO; - - if (status & I2C_STAT_LOST_ARB) - return -EAGAIN; - - if (status & I2C_STAT_STOP_ERR) - return -EBADMSG; - - return -EIO; + return fsi_i2c_error_status_to_rc(status); } if (status & I2C_STAT_DAT_REQ) {