Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3864502imm; Mon, 6 Aug 2018 11:55:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpecP2e76rVRfqz8OJ40r5/C/tJnxRtaREDfGBOmb6LaZjyF/hnUp/COW4vvW3SNUO7uYdur X-Received: by 2002:a63:8dca:: with SMTP id z193-v6mr15726503pgd.228.1533581731692; Mon, 06 Aug 2018 11:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533581731; cv=none; d=google.com; s=arc-20160816; b=wMoLuP/83TSCs1XnYppcW+/9NM/+zTdM2wDYQPdLTAKB3EDx+0c95x5EWinKY4TP07 Wb9ocu8zDGOjAe4gydaPEbST0CYzz2TO4kpNAefNzuNpWR18HWgrMlQy2CF7sS3aU1Ay RnrjEuXdXyOLXSATJyfdhLYsS2xDQlHa259e7TbrAdny1W/EQyi4ISI5Ehfp66C9LaHo KjN0PSrTnlvT6zT7NGGZYvQjeq6aF9ONJYKjJYDFFvEMxQ73tzTVKXhWi8fQpzMtXz0y EE/mgr+XSq94y432h8/sBmUIaD93aN9h5DfnNr8AlOUISeYbnXAby5jOoj2N7GNl6cns pP5Q== 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=13c3M0tcgkDhO3/TC61HLZklTebbHRpqwE8+3MuqeJA=; b=Um3e56/+H+sP+OIorGrE+vCMwrMFIJNAiRDFIWgNGP+GQq6GXviirpgogsK+Xc87CJ 4oJ30Uyyan5boDYt5Uq6aMzVLA43D7A38+JtEvBX4t5bxV2gSVoakdKqbmzS0c0bBkn3 Ri1XwVcq4SZDExdZSVb9ETV0TJ+XQ9jv32Gwt6fXOkuyOBa2MCWHM/rUZZrBGYVLDmg8 oMNiQAEypk0lhDTAIC63vum8hlIuXj4xlmhgJZcka7LU9QYIrb356ZNEi0LaM7WcSKtN vElSNXRRwT9CUCyRmZSEYmxpYFId6jyoXIualQrBiUUmoqNtZ3/Xa6Tq0XS+0nlTVebC CVHQ== 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 h2-v6si10776746plh.339.2018.08.06.11.55.17; Mon, 06 Aug 2018 11:55:31 -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 S1732965AbeHFVEo (ORCPT + 99 others); Mon, 6 Aug 2018 17:04:44 -0400 Received: from mail.bootlin.com ([62.4.15.54]:37140 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729861AbeHFVEo (ORCPT ); Mon, 6 Aug 2018 17:04:44 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 951A7207DA; Mon, 6 Aug 2018 20:54:15 +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 (LPuteaux-656-1-243-71.w82-127.abo.wanadoo.fr [82.127.120.71]) by mail.bootlin.com (Postfix) with ESMTPSA id 55D4D2072D; Mon, 6 Aug 2018 20:54:15 +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 v3 3/6] i2c: designware: allow IP specific sda_hold_time Date: Mon, 6 Aug 2018 20:54:09 +0200 Message-Id: <20180806185412.7210-4-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180806185412.7210-1-alexandre.belloni@bootlin.com> References: <20180806185412.7210-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. Signed-off-by: Alexandre Belloni Reviewed-by: Andy Shevchenko --- 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 e67d6c7d552c..463906a02c7f 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 70c188d6fb6b..870444bbbcc4 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.18.0