Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2445122imm; Thu, 16 Aug 2018 09:42:04 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzH3ioGdHUg/bXP2ybTZMds6LCkEAM6YHH92jENSHoouifA5PelewR5b+OllEXOoUhz03bh X-Received: by 2002:a63:b40e:: with SMTP id s14-v6mr30186143pgf.9.1534437724226; Thu, 16 Aug 2018 09:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534437724; cv=none; d=google.com; s=arc-20160816; b=ey6jF84fpzp3LFaP0A5c7552n2Jy3ToZNBFEmB0D+H+t1OajRocF4857SFhMC7mx+V iOWIdKErfTgvAIQGJN6JNiKKMVuEtlnwuV3ESVWdWJ4z87MS7RgtlizLItBPQnsGkPzG bP1GxYMfPTYhiNxBBPL3SoeP6kpXDzEKnAyDO5qIQWpcW8c1U1wWKz726G1tTuZBbK/s VvUkuS1UUYKL9hXpDrMoBRxFYYmKRE8uiKjazkZqfSfoCnv5D7dZUsV/eyG+Ow7Mvdh+ eRRJv2dyHpd9VKnGGt5xOrumIIezlQ1FTWq8oM+KrU3n5lKDyXEXR5AHLr5blbZkSW9Z RVyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=6NH19k9zYInX1LmUz9I/NGPDO8SNytNrI/oAwRpwaH8=; b=VgzDoPLAdeS0wO85zim3v3iwQWdCvOwjULC8gvC/blTG5NgashB8fGtU0lP32vVVgq COkvMKz5CS3XGUEL8KJPkyB45aM5NL+HQYV4W+4NgN18DGQrFKCf9aBz4PmSZTe0AoQM udoPA6obUVDL/mbW4yCnUOKqXzi+ZpdI9IHpie14sDYCozWuklI7dr6mMeAL/VkwXygL 6+0v8+dSCYJEx7rqqMrDnBtnR4YZlyQ5hfIeMEu3oYG3LDp3eGsYAh7XTHuZpQUQVWn9 HqW2LidsZ7Q5cJRHPv05kjcHj/uGHsyjHzDgX7uBGM+jb+R7+1usjKMwat/xaDIsl/yG YFhQ== 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 21-v6si2026816pgg.588.2018.08.16.09.41.48; Thu, 16 Aug 2018 09:42:04 -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 S2390178AbeHPLmk (ORCPT + 99 others); Thu, 16 Aug 2018 07:42:40 -0400 Received: from mail.bootlin.com ([62.4.15.54]:51601 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390158AbeHPLmj (ORCPT ); Thu, 16 Aug 2018 07:42:39 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 0A6D720F71; Thu, 16 Aug 2018 10:45:38 +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 (unknown [78.250.249.73]) by mail.bootlin.com (Postfix) with ESMTPSA id A16FF2072F; Thu, 16 Aug 2018 10:45:27 +0200 (CEST) From: Alexandre Belloni To: Wolfram Sang , Jarkko Nikula , James Hogan Cc: Paul Burton , 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 v4 3/7] i2c: designware: allow IP specific sda_hold_time Date: Thu, 16 Aug 2018 10:45:17 +0200 Message-Id: <20180816084521.16289-4-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180816084521.16289-1-alexandre.belloni@bootlin.com> References: <20180816084521.16289-1-alexandre.belloni@bootlin.com> 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 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 bcc1bcbf0350..4f4bcefbf404 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -214,6 +214,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 cdba58a3e359..ad4e9619d365 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -282,6 +282,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.18.0