Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1059663imm; Wed, 13 Jun 2018 12:37:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJjRy8wHQUELeDG8oKXQ9/MkKuGd4kVZVT69MFcLh8sC4NGIL+9OiXyb33ktz7ppTVE0WSc X-Received: by 2002:a17:902:7484:: with SMTP id h4-v6mr6439798pll.154.1528918676239; Wed, 13 Jun 2018 12:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528918676; cv=none; d=google.com; s=arc-20160816; b=pf2LCDiehTsPGD7WA7eCdmjxI5730j1cpTOeikNwOKqA3XPF1PtIpJXtLOka/BjUxI PX24ONprRchuxiq6f6YsuRu4hy98RERgZ7IX91IHv9sVO1Zin65G6IALkE9clNDpABEH B6gjooaFu5LoGSO+XqYRMSg2M3prxezm8b7scosgQbsYrKiWyT+JaYhhn4uM6QNmJnJM dws460SDvgH9EAD1ljOAgYUF4H/RMClT7e+2KNVRsLIx0X6bs7u/7zRepV9yygxUbKdi OM/sq+vSzMTlWKbK4mUj/0fGNFSnIb/g/OckMdq9q37bSAj8wVQz3fViDqw8FuQ5bs6g TH4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=dSgZEkgrlEQ59xgyuLw/aVmueUgjffc4FbacKCAUWfc=; b=A8HtHwe5oqAi6nvU8ZCJCuK5xNzucuu7hN7oser8I4YZoj9/MkLI3ew+fc5vSi/NLX ZGyTw51/lb6fo6VQXBy7t944QMLJr0k9/FDDKoqBEL8RwTtRO7qLJKA9Mc5ux8OZ5Abt OgxaJEisdkADsP5FFJrzfOP8xcXGEHLnB8K3OxeId7K/xB7cCwuwGlUL5A3WmtPCdvJ+ x6/aeUzvGDN/bR0gdo19ypRhEaqTQXEaxb1KORp+elJ/BnYM3rGV3hDtMB4tVFG2DP/b hK69/xbAKIuSR4pKwTMfjoz5/wiksVg9uqPVfrHTKkrHj63g2xBkYqy7GdKqp/V6PfeS b8+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8-v6si3543617plk.406.2018.06.13.12.37.41; Wed, 13 Jun 2018 12:37:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935748AbeFMTgu (ORCPT + 99 others); Wed, 13 Jun 2018 15:36:50 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51280 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935699AbeFMTgm (ORCPT ); Wed, 13 Jun 2018 15:36:42 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5DJYKAq023286 for ; Wed, 13 Jun 2018 15:36:41 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0b-001b2d01.pphosted.com with ESMTP id 2jk88xuc90-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 13 Jun 2018 15:36:41 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 13 Jun 2018 13:36:40 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 13 Jun 2018 13:36:36 -0600 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5DJaZ1A10944824 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 13 Jun 2018 12:36:35 -0700 Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12F59C6061; Wed, 13 Jun 2018 13:36:35 -0600 (MDT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6BDBEC605D; Wed, 13 Jun 2018 13:36:34 -0600 (MDT) Received: from talon7.ibm.com (unknown [9.41.102.69]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 13 Jun 2018 13:36:34 -0600 (MDT) From: Eddie James To: linux-i2c@vger.kernel.org Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, wsa@the-dreams.de, robh+dt@kernel.org, benh@kernel.crashing.org, joel@jms.id.au, mark.rutland@arm.com, gregkh@linuxfoundation.org, rdunlap@infradead.org, andy.shevchenko@gmail.com, peda@axentia.se, Eddie James Subject: [PATCH v10 7/7] i2c: fsi: Add bus recovery Date: Wed, 13 Jun 2018 14:36:19 -0500 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1528918579-27602-1-git-send-email-eajames@linux.vnet.ibm.com> References: <1528918579-27602-1-git-send-email-eajames@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18061319-0016-0000-0000-000008F7D2B1 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009184; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01046494; UDB=6.00535962; IPR=6.00825469; MB=3.00021628; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-13 19:36:39 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18061319-0017-0000-0000-00003F451AF7 Message-Id: <1528918579-27602-8-git-send-email-eajames@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-13_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=997 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806130207 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Bus recovery should reset the engine and force clock the bus 9 times to recover most situations. Signed-off-by: Eddie James --- drivers/i2c/busses/i2c-fsi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index d6cab4b..940b198 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -611,6 +611,24 @@ static u32 fsi_i2c_functionality(struct i2c_adapter *adap) I2C_FUNC_SMBUS_BLOCK_DATA; } +static int fsi_i2c_recover_bus(struct i2c_adapter *adap) +{ + int rc; + struct fsi_i2c_port *port = adap->algo_data; + struct fsi_i2c_master *master = port->master; + + mutex_lock(&master->lock); + + rc = fsi_i2c_reset(master, port->port); + + mutex_unlock(&master->lock); + return rc; +} + +static struct i2c_bus_recovery_info fsi_i2c_bus_recovery_info = { + .recover_bus = fsi_i2c_recover_bus, +}; + static const struct i2c_algorithm fsi_i2c_algorithm = { .master_xfer = fsi_i2c_xfer, .functionality = fsi_i2c_functionality, @@ -653,6 +671,7 @@ static int fsi_i2c_probe(struct device *dev) port->adapter.dev.of_node = np; port->adapter.dev.parent = dev; port->adapter.algo = &fsi_i2c_algorithm; + port->adapter.bus_recovery_info = &fsi_i2c_bus_recovery_info; port->adapter.algo_data = port; snprintf(port->adapter.name, sizeof(port->adapter.name), -- 1.8.3.1