Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3859127imm; Tue, 29 May 2018 15:26:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK+egFE3jMIXObEFr5dGPXtvMuKXgTkDVWoq37+yKmvdsnDQJMZfBUZua9pUsqZZl1nvp2/ X-Received: by 2002:a63:7344:: with SMTP id d4-v6mr172080pgn.273.1527632796651; Tue, 29 May 2018 15:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527632796; cv=none; d=google.com; s=arc-20160816; b=B8TmR1Ga/mCSWksbTcqgXA1aTZsWAG6aeyZFoN9+/pmEC/5DKDUVDKhPdy8EmBtiVn KqW7n2VXOPrKrDCi9SQIf3kvXFkEZBCcklr2oTbcglRAZABRvoE6Tx2J7VBvy7ebtFgN ihSV5QLo/uoEKNlGqsaaylHtJxBsVWfGTG/yBwhiSTXn+Td1+GRE7lpT5dqTpXp+rr/i FPS8pag5DeAGaPVcwfMzYw8uvf30HVlzTePERGu7NL9WIz2pB/RZV1abq8vn1daSP7kk bTzZ3Pz7I4hGyWoKFnBBtAmC9l7mr7Q8BjOyzAa2lnSKuPauuw/EFTMBKewTDM9UQMUL 5tjQ== 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=eUGSuAvCID8kQjt/G0VrACSF1xlSfSFLh0jnpAxnNJQ=; b=EkteKfbwrBhc6CqnlYtxv7l1Kwbah0PJMS7qM4HAOeac0oZv5lPgFiIYhNe7rQUbnN 3T9Gquos1Aw2pTLpWQMphm4DWPraTaeW/7vXeRrp7spRYNvvTZUNmvoPNQji9mOuW1HL rhoq6ccRKposk93hKNfRCy6WmZgsJt8diFB10RwdwWCJ8ylETlU5Np7BJGDyfr6a9BwQ bCsQjxLNtQWSIaDaGmpstg2OhD1f7HxXrADnwW2eaRCUF9doctOcGKQEhAP7JnEY4oZH swVNjcurLWZd9ZjBRxnCaRE4QGeKYTz3yoT2mkaJCey91SMFhbuAP8pmtUW60zh7uSyI vy2Q== 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 p9-v6si32319711pls.460.2018.05.29.15.26.22; Tue, 29 May 2018 15:26:36 -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 S1030246AbeE2WZd (ORCPT + 99 others); Tue, 29 May 2018 18:25:33 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44388 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S968222AbeE2WYy (ORCPT ); Tue, 29 May 2018 18:24:54 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4TMOGsS123646 for ; Tue, 29 May 2018 18:24:54 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0b-001b2d01.pphosted.com with ESMTP id 2j9ewn1dsr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 29 May 2018 18:24:54 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 29 May 2018 16:24:53 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 29 May 2018 16:24:50 -0600 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4TMOnY911272684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 29 May 2018 15:24:49 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 66F027803F; Tue, 29 May 2018 16:24:49 -0600 (MDT) Received: from talon7.ibm.com (unknown [9.80.223.183]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP id EAEEC78037; Tue, 29 May 2018 16:24:47 -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, "Edward A. James" Subject: [PATCH v7 7/7] drivers/i2c: Add bus recovery for FSI algorithm Date: Tue, 29 May 2018 17:24:25 -0500 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1527632665-25707-1-git-send-email-eajames@linux.vnet.ibm.com> References: <1527632665-25707-1-git-send-email-eajames@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18052922-0004-0000-0000-0000142FE0CE X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009097; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000264; SDB=6.01039556; UDB=6.00532065; IPR=6.00818684; MB=3.00021364; MTD=3.00000008; XFM=3.00000015; UTC=2018-05-29 22:24:52 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18052922-0005-0000-0000-0000877305B4 Message-Id: <1527632665-25707-8-git-send-email-eajames@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-29_10:,, 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=948 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1805290238 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Edward A. James" Bus recovery should reset the engine and force clock the bus 9 times to recover most situations. Signed-off-by: Edward A. 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 f309267..52a662c 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -621,6 +621,24 @@ static u32 fsi_i2c_functionality(struct i2c_adapter *adap) | I2C_FUNC_SMBUS_EMUL | 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, @@ -663,6 +681,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