Received: by 10.223.164.202 with SMTP id h10csp141770wrb; Thu, 16 Nov 2017 20:51:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMZytRuUc8x+L5GYbYeHzhm28fk8P8vmHYrwnnslYN3JQEhJVjdfMKCYvyO09ELIOWe6JlYa X-Received: by 10.99.126.93 with SMTP id o29mr3941499pgn.304.1510894295642; Thu, 16 Nov 2017 20:51:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510894295; cv=none; d=google.com; s=arc-20160816; b=tg6p29wYypMLVj2CmYe/7H6xagth9ERiMP8hO9pwkG8SqCaSDkCiPT1F6x+uyow3x5 RJobVjB5Ydgv0aUDQk5UF/gaapTBgt5FpAX+XzzgpUE7To6ZpjLO5B4JUuOaA/AW6wex DHtUKPFmwnqXOzeWW2EJBlal/EJ2gGC1FJDdcExiy/v6c2Pw+kTZYEIcIjVNxNW5sxhl Pp7TSVLEVe+3N7FnQGigp+7K5Ly8LUo6Gv1/rNIY4+SwlX1uA0GwFhNT4XV24KxPYAdI 5G3jCXtXd0D0NZslr938Ji7DoWL9dFJMKPDzuOFH6QYghShl2qWN+VULxRQFsAUCV2AD HgJQ== 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=k51QYwDqT8jUxRxdPBr2121ReGu6PTKxFY9MFYYiSRc=; b=VzER5wrGiZD+7T8qZTPIbGuSQtC/7Sy9NEiKzuWw3RXwvVMmTiifNpIOxxZPnSEG2U Si4GFMl1P4MOyNCLdw3Jp1qFjnqFpsR0laGQ/7TICPCBA1RyGJkfCbhArfRn3Kx0aItX 3OGMkMYHEuEGpgGUPb9jEIbjehFT6agOquM1Eek+spCkJvTQNPOv28Wj63exB+3UxlZj ItumVQFnsgMepl2Hieaw7yJleAaIoU2rmz/nvBf7DV5gSxZtvr9Tf3nb5kKO5gYTu661 LYK0JwWezHU1rrDgxlXyPydpVT0nhwJwsN5riTF9NIQUaY835FtnZhsiXVgmeTXCbuiz P3zA== 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 d30si2065419pld.506.2017.11.16.20.51.21; Thu, 16 Nov 2017 20:51:35 -0800 (PST) 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 S933451AbdKPTzB (ORCPT + 92 others); Thu, 16 Nov 2017 14:55:01 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41900 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933240AbdKPTym (ORCPT ); Thu, 16 Nov 2017 14:54:42 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vAGJseLo075356 for ; Thu, 16 Nov 2017 14:54:41 -0500 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2e9ew7fkrf-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 16 Nov 2017 14:54:41 -0500 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 16 Nov 2017 12:54:24 -0700 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 16 Nov 2017 12:54:20 -0700 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vAGJsK2X66125850; Thu, 16 Nov 2017 12:54:20 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6C1BE78038; Thu, 16 Nov 2017 12:54:20 -0700 (MST) Received: from oc3016140333.ibm.com (unknown [9.85.131.228]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP id 45E0178037; Thu, 16 Nov 2017 12:54:19 -0700 (MST) From: Eddie James To: linux-kernel@vger.kernel.org Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, wsa@the-dreams.de, robh+dt@kernel.org, joel@jms.id.au, eajames@linux.vnet.ibm.com, "Edward A. James" Subject: [PATCH v6 7/7] drivers/i2c: Add bus recovery for FSI algorithm Date: Thu, 16 Nov 2017 13:53:52 -0600 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1510862032-12394-1-git-send-email-eajames@linux.vnet.ibm.com> References: <1510862032-12394-1-git-send-email-eajames@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17111619-0012-0000-0000-0000154E9FBC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008076; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000240; SDB=6.00946833; UDB=6.00477975; IPR=6.00727126; BA=6.00005695; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018049; XFM=3.00000015; UTC=2017-11-16 19:54:23 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17111619-0013-0000-0000-0000504B6D56 Message-Id: <1510862032-12394-8-git-send-email-eajames@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-16_06:,, 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1711160266 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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c index 1751c44..10f693f 100644 --- a/drivers/i2c/busses/i2c-fsi.c +++ b/drivers/i2c/busses/i2c-fsi.c @@ -671,6 +671,27 @@ 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; + + rc = fsi_i2c_lock_master(master, adap->timeout); + if (rc) + return rc; + + rc = fsi_i2c_reset(master, port->port); + + fsi_i2c_unlock_master(master); + + 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, @@ -715,6 +736,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 From 1585138561635113156@xxx Sun Nov 26 14:18:54 +0000 2017 X-GM-THRID: 1584969567482211653 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread