Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp593228imm; Fri, 31 Aug 2018 08:13:25 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYpMhT4s27OamHS2r0MJ61Kddn3KfyUICjrIL/965dXnHWSISWIZ/ZLhAH6SqnV/KQHBKJr X-Received: by 2002:a63:9751:: with SMTP id d17-v6mr15113529pgo.386.1535728404958; Fri, 31 Aug 2018 08:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535728404; cv=none; d=google.com; s=arc-20160816; b=zt8cGW66Wdo59VprpYlckgiqHF7aMifK9yt2v/Trn33+7cahDCvfM5lwkaVuZN+9QX wlrkk2BHC0ZtIhVKfVWw1Ivs14mCP+sQsfnnANS9et+YKNGUuQlycEiLYu+e0x90cuHi NfMERUi8bcbWbcgXp2Z20ai2niIcomZTdPlQpBt5G7UYTAPqpAdLGCRgf6n0wRr4wyNR VH5MDCI7betTQsTkVWLNmkOcVirxM6T/PkrLHnccNjkFEPltl4zLaUwbz6j3L5/xZEOX IZ1kvGObwy2GyOmc2qQAiv6xN7P5mbzJImp/BIz8+1BCDl9Nb2JF7tcsi+Fi8BH7uyH6 +zCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=BwR4mLd7Bkr/tdOav4LSTsNE0T49XIr2xT1IhlINGNg=; b=XiKaz9UMtc6kcx+EEqtGFlve8JQ8ah9VQGlm45ikVNaYRA4yYL0xIOneAWeizlHYZY uf8H/o6HGK9v/fFTPKbLXNL1Vocokh6y5l9QiJwZ0enG8iJpkRrCyeCH58gX26Z1ssLe X74aFQMl9r1/T/zZFFi7qqMjo94Ahx5SydjSgROiolpNU1FpVjVNjrZ96KXzCF7DRVZs GGc5+ez5nDvDXzut1caVDk0a3UsATJw2ECBWF0BkL183+9hpJLrnhiDjtv/2heB9IsHw dy7GvvafdXf1gIuD+oBDrgdpu/DBxn1YK6ZDWMT4lV4MihpgU3FAHAXr+NUMqUt/LiKp GTiQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s24-v6si9959393plq.358.2018.08.31.08.13.10; Fri, 31 Aug 2018 08:13:24 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728756AbeHaTTs (ORCPT + 99 others); Fri, 31 Aug 2018 15:19:48 -0400 Received: from mail.bootlin.com ([62.4.15.54]:46999 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728553AbeHaTTr (ORCPT ); Fri, 31 Aug 2018 15:19:47 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id A0CD020756; Fri, 31 Aug 2018 17:11:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (242.171.71.37.rev.sfr.net [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id 48B5322A39; Fri, 31 Aug 2018 17:11:28 +0200 (CEST) From: Alexandre Belloni To: Wolfram Sang , Jarkko Nikula , James Hogan , Paul Burton Cc: Andy Shevchenko , Mika Westerberg , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Thomas Petazzoni , Allan Nielsen , Alexandre Belloni Subject: [PATCH v5 3/7] i2c: designware: allow IP specific sda_hold_time Date: Fri, 31 Aug 2018 17:11:10 +0200 Message-Id: <20180831151114.25739-4-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.19.0.rc1 In-Reply-To: <20180831151114.25739-1-alexandre.belloni@bootlin.com> References: <20180831151114.25739-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Because some old designware IPs were not supporting setting an SDA hold time, vendors developed their own solution. Add a way for the final driver to provide its own SDA hold time handling. Reviewed-by: Andy Shevchenko Tested-by: Jarkko Nikula Acked-by: Jarkko Nikula Signed-off-by: Alexandre Belloni --- drivers/i2c/busses/i2c-designware-common.c | 2 ++ drivers/i2c/busses/i2c-designware-core.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index 69ec4a791f23..36271cd75342 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -201,6 +201,8 @@ int i2c_dw_set_sda_hold(struct dw_i2c_dev *dev) dev_dbg(dev->dev, "SDA Hold Time TX:RX = %d:%d\n", dev->sda_hold_time & ~(u32)DW_IC_SDA_HOLD_RX_MASK, dev->sda_hold_time >> DW_IC_SDA_HOLD_RX_SHIFT); + } else if (dev->set_sda_hold_time) { + dev->set_sda_hold_time(dev); } else if (dev->sda_hold_time) { dev_warn(dev->dev, "Hardware too old to adjust SDA hold time.\n"); diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index e367b1af4ab2..f6cad20a86ff 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -269,6 +269,7 @@ struct dw_i2c_dev { void (*disable)(struct dw_i2c_dev *dev); void (*disable_int)(struct dw_i2c_dev *dev); int (*init)(struct dw_i2c_dev *dev); + int (*set_sda_hold_time)(struct dw_i2c_dev *dev); int mode; struct i2c_bus_recovery_info rinfo; }; -- 2.19.0.rc1