From patchwork Wed Jul 23 15:44:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime COQUELIN X-Patchwork-Id: 34164 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7C38820672 for ; Wed, 23 Jul 2014 15:44:38 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id ij19sf4179639vcb.8 for ; Wed, 23 Jul 2014 08:44:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=UZWlncRdh8rFHdN5EhzQzr02D+PvAUOQcCDcJ1w3i+Q=; b=LP7PrjHmX8y1NbcsQqOySWQzV8afXk1LT76ZytvZ07F8oLVcNMrLQbGNCTibq/D6Wr MUuEDLqyguMgenxF/2b1t9dGsnBekIYghE5czPbZyVn6RZTaDAAnEi/3VKOyVjVelOAs jt8ekUIIKnc2Zv85WJLQ0c3GzI9COMJ7JpPjPQbu31NXvv49HOjlHf9N8D2rp8lPY4Rs TFV8dPfOxJm8SZuBTNUrWqnBznF7cA76o8xcXDF8hCYRrtyYUFsn0Y8nagWCXZ3dsbDv BHXFH6nkdEstutxPHb3VatKn/bLXwDJymC2GlJpUDdBtb1D/H/emE8YYq1fYOM4A7qEU 28Og== X-Gm-Message-State: ALoCoQmr2go4rfh1A/mLXDWUpYnOu0t46TFR5MbvfASmkv6oqv6RC++vcWkE5WP5PKwvLSOp61Md X-Received: by 10.224.171.130 with SMTP id h2mr981179qaz.7.1406130278242; Wed, 23 Jul 2014 08:44:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.165 with SMTP id d34ls400820qgd.25.gmail; Wed, 23 Jul 2014 08:44:38 -0700 (PDT) X-Received: by 10.52.119.196 with SMTP id kw4mr2647926vdb.75.1406130278047; Wed, 23 Jul 2014 08:44:38 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id br4si2451505vcb.106.2014.07.23.08.44.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Jul 2014 08:44:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf12so2511479vcb.26 for ; Wed, 23 Jul 2014 08:44:38 -0700 (PDT) X-Received: by 10.220.15.8 with SMTP id i8mr3212613vca.45.1406130277700; Wed, 23 Jul 2014 08:44:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp290639vcb; Wed, 23 Jul 2014 08:44:37 -0700 (PDT) X-Received: by 10.66.119.132 with SMTP id ku4mr1309280pab.121.1406130274366; Wed, 23 Jul 2014 08:44:34 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ow8si1471910pdb.334.2014.07.23.08.44.34 for ; Wed, 23 Jul 2014 08:44:34 -0700 (PDT) Received-SPF: none (google.com: linux-i2c-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757967AbaGWPod (ORCPT + 2 others); Wed, 23 Jul 2014 11:44:33 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:57058 "EHLO mx08-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757616AbaGWPoc (ORCPT ); Wed, 23 Jul 2014 11:44:32 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id s6NFhfC6006963; Wed, 23 Jul 2014 17:44:26 +0200 Received: from beta.dmz-us.st.com (beta.dmz-us.st.com [167.4.1.35]) by mx08-00178001.pphosted.com with ESMTP id 1nab4921qu-1 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Wed, 23 Jul 2014 17:44:26 +0200 Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 33B0826; Wed, 23 Jul 2014 15:44:23 +0000 (GMT) Received: from mail7.sgp.st.com (unknown [164.129.223.81]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 6CB7557; Wed, 23 Jul 2014 15:44:21 +0000 (GMT) Received: from lmenx29l.lme.st.com ([10.201.23.80]) by mail7.sgp.st.com (MOS 4.3.3-GA) with ESMTP id BZR07020 (AUTH lme00137); Wed, 23 Jul 2014 17:44:16 +0200 From: Maxime COQUELIN To: Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla , Patrice Chotard Cc: kernel@stlinux.com, maxime.coquelin@st.com Subject: [PATCH v2] drivers: i2c: i2c-st: Update i2c timings Date: Wed, 23 Jul 2014 17:44:07 +0200 Message-Id: <1406130247-19197-1-git-send-email-maxime.coquelin@st.com> X-Mailer: git-send-email 1.9.1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52, 1.0.14, 0.0.0000 definitions=2014-07-23_06:2014-07-23, 2014-07-23, 1970-01-01 signatures=0 Sender: linux-i2c-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-i2c@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxime.coquelin@st.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The i2c timing values specified in the driver are the minimun values defined in the I2C specifications. The I2C specification does not specify any default or maximum values. Some I2C devices are out of spec, such as the HDMI link of the Toshiba 19AV600 TV, and might not work properly with minimum values. This patch adds a 10% margin on all the timings in both Normal and Fast modes. Trial and error method have been used to find the minimum margin necessary to have the out-of-spec device working, and a security margin has been added. Signed-off-by: Maxime Coquelin --- drivers/i2c/busses/i2c-st.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c index 95b94767..4ab14ad 100644 --- a/drivers/i2c/busses/i2c-st.c +++ b/drivers/i2c/busses/i2c-st.c @@ -206,25 +206,31 @@ static inline void st_i2c_clr_bits(void __iomem *reg, u32 mask) writel_relaxed(readl_relaxed(reg) & ~mask, reg); } -/* From I2C Specifications v0.5 */ +/* + * From I2C Specifications v0.5. + * + * All the values below have +10% margin added to be + * compatible with some out-of-spec devices, + * like HDMI link of the Toshiba 19AV600 TV. + */ static struct st_i2c_timings i2c_timings[] = { [I2C_MODE_STANDARD] = { .rate = 100000, - .rep_start_hold = 4000, - .rep_start_setup = 4700, - .start_hold = 4000, - .data_setup_time = 250, - .stop_setup_time = 4000, - .bus_free_time = 4700, + .rep_start_hold = 4400, + .rep_start_setup = 5170, + .start_hold = 4400, + .data_setup_time = 275, + .stop_setup_time = 4400, + .bus_free_time = 5170, }, [I2C_MODE_FAST] = { .rate = 400000, - .rep_start_hold = 600, - .rep_start_setup = 600, - .start_hold = 600, - .data_setup_time = 100, - .stop_setup_time = 600, - .bus_free_time = 1300, + .rep_start_hold = 660, + .rep_start_setup = 660, + .start_hold = 660, + .data_setup_time = 110, + .stop_setup_time = 660, + .bus_free_time = 1430, }, };